AdversarialOptimizer#
- class deepinv.training.AdversarialOptimizer(optimizer_g, optimizer_d, zero_grad_g_only=False, zero_grad_d_only=False)[source]#
Bases:
object
Optimizer for adversarial training that encapsulates both generator and discriminator’s optimizers.
- Parameters:
optimizer_g (torch.optim.Optimizer) – generator’s torch optimizer
optimizer_d (torch.optim.Optimizer) – discriminator’s torch optimizer
zero_grad_g_only (bool) – whether to only zero_grad generator, defaults to
False
zero_grad_d_only (bool) – whether to only zero_grad discriminator, defaults to
False
- load_state_dict(state_dict)[source]#
Load state_dict which must have “G” and “D” keys for generator and discriminator respectively
- Parameters:
state_dict (dict) – state_dict with keys “G” and “D”.
Examples using AdversarialOptimizer
:#
Imaging inverse problems with adversarial networks
Imaging inverse problems with adversarial networks