(model, **kwargs)
Trains progressive GAN for stage `stage_id`.

  Args:
    model: An model object having all information of progressive GAN model,
        e.g. the return of build_model().
    **kwargs: A dictionary of
        'train_root_dir': A string of root directory of training logs.
        'master': Name of the TensorFlow master to use.
        'task': The Task ID. This value is used when training with multiple
            workers to identify each worker.
        'save_summaries_num_images': Save summaries in this number of images.
        'debug_hook': Whether to attach the debug hook to the training session.
  Returns:
    None.
Trains progressive GAN for stage `stage_id`.
Trains progressive GAN for stage stage_id .
def train(model, **kwargs):
  """Trains progressive GAN for stage `stage_id`.

  Args:
    model: An model object having all information of progressive GAN model,
        e.g. the return of build_model().
    **kwargs: A dictionary of
        'train_root_dir': A string of root directory of training logs.
        'master': Name of the TensorFlow master to use.
        'task': The Task ID. This value is used when training with multiple
            workers to identify each worker.
        'save_summaries_num_images': Save summaries in this number of images.
        'debug_hook': Whether to attach the debug hook to the training session.
  Returns:
    None.
  """
  logging.info('stage_id=%d, num_blocks=%d, num_images=%d', model.stage_id,
               model.num_blocks, model.num_images)

  scaffold = make_scaffold(model.stage_id, model.optimizer_var_list, **kwargs)

  logdir = make_train_sub_dir(model.stage_id, **kwargs)
  print('starting training, logdir: {}'.format(logdir))
  hooks = []
  if model.stage_train_time_limit is None:
    hooks.append(tf.train.StopAtStepHook(last_step=model.num_images))
  hooks.append(tf.train.LoggingTensorHook(
      [make_status_message(model)], every_n_iter=1))
  hooks.append(TrainTimeHook(model.train_time, model.stage_train_time_limit))
  if kwargs['debug_hook']:
    hooks.append(ProganDebugHook())
  tfgan.gan_train(
      model.gan_train_ops,
      logdir=logdir,
      get_hooks_fn=tfgan.get_sequential_train_hooks(tfgan.GANTrainSteps(1, 1)),
      hooks=hooks,
      master=kwargs['master'],
      is_chief=(kwargs['task'] == 0),
      scaffold=scaffold,
      save_checkpoint_secs=600,
      save_summaries_steps=(kwargs['save_summaries_num_images']))
def train ( model , * * kwargs ) : logging . info ( 'stage_id=%d, num_blocks=%d, num_images=%d' , model . stage_id , model . num_blocks , model . num_images ) scaffold = make_scaffold ( model . stage_id , model . optimizer_var_list , * * kwargs ) logdir = make_train_sub_dir ( model . stage_id , * * kwargs ) print ( 'starting training, logdir: {}' . format ( logdir ) ) hooks = [ ] if model . stage_train_time_limit is None : hooks . append ( tf . train . StopAtStepHook ( last_step = model . num_images ) ) hooks . append ( tf . train . LoggingTensorHook ( [ make_status_message ( model ) ] , every_n_iter = 1 ) ) hooks . append ( TrainTimeHook ( model . train_time , model . stage_train_time_limit ) ) if kwargs [ 'debug_hook' ] : hooks . append ( ProganDebugHook ( ) ) tfgan . gan_train ( model . gan_train_ops , logdir = logdir , get_hooks_fn = tfgan . get_sequential_train_hooks ( tfgan . GANTrainSteps ( 1 , 1 ) ) , hooks = hooks , master = kwargs [ 'master' ] , is_chief = ( kwargs [ 'task' ] == 0 ) , scaffold = scaffold , save_checkpoint_secs = 600 , save_summaries_steps = ( kwargs [ 'save_summaries_num_images' ] ) )