class_docstr: Switcher that goes back to generator/critic when the loss goes below `gen_thresh`/`crit_thresh`.
class_docstr_tok: ["Switcher","that","goes","back","to","generator\/critic","when","the","loss","goes","below","`","gen_thresh","`","\/","`","crit_thresh","`","."]
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.gan_trainer.gen_mode:
          if self.gen_thresh is None or self.loss < self.gen_thresh:
              self.gan_trainer.switch()
      else:
          if (
              self.critic_thresh is None
              or self.loss < self.critic_thresh
          ):
              self.gan_trainer.switch()
  
imports: from __future__ import annotations
  from ..basics import *
  from .all import *
label_desc: Use image node_id 2 for calling the AdaptiveGANSwitcher obj's underlying member method code with example usage: obj.after_batch() without return types