docstr: Args:
      input (InputSource):
      model (GANModelDesc):
docstr_tok: ["Args",":","input","(","InputSource",")",":","model","(","GANModelDesc",")",":"]
code: def __init__(self, input, model, num_gpu=1):
      """
      Args:
          input (InputSource):
          model (GANModelDesc):
      """
      super(GANTrainer, self).__init__()
      assert isinstance(model, GANModelDesc), model
  
      if num_gpu > 1:
          input = StagingInput(input)
  
      # Setup input
      cbs = input.setup(model.get_input_signature())
      self.register_callback(cbs)
  
      if num_gpu <= 1:
          self._build_gan_trainer(input, model)
      else:
          self._build_multigpu_gan_trainer(input, model, num_gpu)
  
imports: import numpy
  import tensorflow
  from tensorpack import BatchNorm, DataFlow, ModelDescBase, StagingInput, TowerTrainer, argscope
  from tensorpack.graph_builder import DataParallelBuilder, LeastLoadedDeviceSetter
  from tensorpack.tfutils.summary import add_moving_summary
  from tensorpack.tfutils.tower import TowerContext, TowerFunc
  from tensorpack.utils import logger
  from tensorpack.utils.argtools import memoized_method
label_desc: Use image node_id 1 to create a new GANTrainer object from inherited base classes: TowerTrainer with example: obj = GANTrainer(input, model, num_gpu)