class_docstr: Switcher to do `n_crit` iterations of the critic then `n_gen` iterations of the generator.
class_docstr_tok: ["Switcher","to","do","`","n_crit","`","iterations","of","the","critic","then","`","n_gen","`","iterations","of","the","generator","."]
docstr: Switch the model if necessary.
docstr_tok: ["Switch","the","model","if","necessary","."]
code: def after_batch(self):
      "Switch the model if necessary."
      if not self.training:
          return
      if self.learn.gan_trainer.gen_mode:
          self.n_g += 1
          n_iter, n_in, n_out = self.n_gen, self.n_c, self.n_g
      else:
          self.n_c += 1
          n_iter, n_in, n_out = self.n_crit, self.n_g, self.n_c
      target = n_iter if isinstance(n_iter, int) else n_iter(n_in)
      if target == n_out:
          self.learn.gan_trainer.switch()
          self.n_c, self.n_g = 0, 0
  
imports: from __future__ import annotations
  from ..basics import *
  from .all import *
label_desc: Use image node_id 3 for calling the FixedGANSwitcher obj's underlying member method code with example usage: obj.after_batch() without return types