class_docstr: Callback to handle GAN Training.
class_docstr_tok: ["Callback","to","handle","GAN","Training","."]
docstr: Clamp the weights with `self.clip` if it's not None, set the correct input/target.
docstr_tok: ["Clamp","the","weights","with","`","self.clip","`","if","it","'s","not","None",",","set","the","correct","input\/target","."]
code: def before_batch(self):
      "Clamp the weights with `self.clip` if it's not None, set the correct input/target."
      if self.training and self.clip is not None:
          for p in self.critic.parameters():
              p.data.clamp_(-self.clip, self.clip)
      if not self.gen_mode:
          (self.learn.xb, self.learn.yb) = (self.yb, self.xb)
  
imports: from __future__ import annotations
  from ..basics import *
  from .all import *
label_desc: Use image node_id 5 for calling the GANTrainer obj's underlying member method code with example usage: obj.before_batch() without return types