class_docstr: A `Learner` suitable for GANs.
class_docstr_tok: ["A","`","Learner","`","suitable","for","GANs","."]
code: def __init__(
      self,
      dls: DataLoaders,  # DataLoaders object for GAN data
      generator: nn.Module,  # Generator model
      critic: nn.Module,  # Critic model
      gen_loss_func: callable,  # Generator loss function
      crit_loss_func: callable,  # Critic loss function
      switcher: Callback
      | None = None,  # Callback for switching between generator and critic training, defaults to `FixedGANSwitcher`
      gen_first: bool = False,  # Whether we start with generator training
      switch_eval: bool = True,  # Whether the model should be set to eval mode when calculating loss
      show_img: bool = True,  # Whether to show example generated images during training
      clip: None | float = None,  # How much to clip the weights
      cbs: Callback
      | None
      | MutableSequence = None,  # Additional callbacks
      metrics: None | MutableSequence | callable = None,  # Metrics
      **kwargs,
  ):
      gan = GANModule(generator, critic)
      loss_func = GANLoss(gen_loss_func, crit_loss_func, gan)
      if switcher is None:
          switcher = FixedGANSwitcher()
      trainer = GANTrainer(
          clip=clip,
          switch_eval=switch_eval,
          gen_first=gen_first,
          show_img=show_img,
      )
      cbs = L(cbs) + L(trainer, switcher)
      metrics = L(metrics) + L(*LossMetrics("gen_loss,crit_loss"))
      super().__init__(
          dls,
          gan,
          loss_func=loss_func,
          cbs=cbs,
          metrics=metrics,
          **kwargs,
      )
  
imports: from __future__ import annotations
  from ..basics import *
  from .all import *
label_desc: Use image node_id 1 to create a new GANLearner object from inherited base classes: Learner with example: obj = GANLearner(dls, generator, critic, gen_loss_func, crit_loss_func, switcher, gen_first, switch_eval, show_img, clip, cbs, metrics)