class_docstr: Model for Generative Adversarial Networks.
  
  Arguments:
      layers: Generative Adversarial layer container
      noise_dim (Tuple): Dimensionality of the noise feeding the generator
      noise_type (Str): Noise distribution, 'normal' (default) or 'uniform'
      weights_only (bool): set to True if you do not want to recreate layers
                           and states during deserialization from a serialized model
                           description.  Defaults to False.
      name (str): Model name.  Defaults to "model"
      optimizer (Optimizer): Optimizer object which defines the learning rule for updating
                             model parameters (i.e., GradientDescentMomentum, Adadelta)
      k (int): Number of data batches per noise batch
      wgan_param_clamp (float or None): In case of WGAN weight clamp value, None for others
      wgan_train_sched (bool): Whether to use the FAIR WGAN training schedule of critics
class_docstr_tok: ["Model","for","Generative","Adversarial","Networks",".","Arguments",":","layers",":","Generative","Adversarial","layer","container","noise_dim","(","Tuple",")",":","Dimensionality","of","the","noise","feeding","the","generator","noise_type","(","Str",")",":","Noise","distribution",",","'normal","'","(","default",")","or","'uniform'","weights_only","(","bool",")",":","set","to","True","if","you","do","not","want","to","recreate","layers","and","states","during","deserialization","from","a","serialized","model","description",".","Defaults","to","False",".","name","(","str",")",":","Model","name",".","Defaults","to","``","model","''","optimizer","(","Optimizer",")",":","Optimizer","object","which","defines","the","learning","rule","for","updating","model","parameters","(","i.e.",",","GradientDescentMomentum",",","Adadelta",")","k","(","int",")",":","Number","of","data","batches","per","noise","batch","wgan_param_clamp","(","float","or","None",")",":","In","case","of","WGAN","weight","clamp","value",",","None","for","others","wgan_train_sched","(","bool",")",":","Whether","to","use","the","FAIR","WGAN","training","schedule","of","critics"]
docstr: Helper function for fit which performs training on a dataset for one epoch.
  
  Arguments:
      dataset (NervanaDataIterator): Dataset iterator to perform fit on
docstr_tok: ["Helper","function","for","fit","which","performs","training","on","a","dataset","for","one","epoch",".","Arguments",":","dataset","(","NervanaDataIterator",")",":","Dataset","iterator","to","perform","fit","on"]
code: def _epoch_fit(self, dataset, callbacks):
      """
      Helper function for fit which performs training on a dataset for one epoch.
  
      Arguments:
          dataset (NervanaDataIterator): Dataset iterator to perform fit on
      """
      epoch = self.epoch_index
      self.total_cost[:] = 0
      last_gen_iter = self.gen_iter
      z, y_temp = self.zbuf, self.ybuf
  
      # iterate through minibatches of the dataset
      for mb_idx, (x, _) in enumerate(dataset):
          callbacks.on_minibatch_begin(epoch, mb_idx)
          self.be.begin(Block.minibatch, mb_idx)
  
          # clip all discriminator parameters to a cube in case of WGAN
          if self.wgan_param_clamp:
              self.clip_param_in_layers(
                  self.layers.discriminator.layers_to_optimize,
                  self.wgan_param_clamp,
              )
  
          # train discriminator on noise
          self.fill_noise(z, normal=(self.noise_type == "normal"))
          Gz = self.fprop_gen(z)
          y_noise = self.fprop_dis(Gz)
          y_temp[:] = y_noise
          delta_noise = self.cost.costfunc.bprop_noise(y_noise)
          self.bprop_dis(delta_noise)
          self.layers.discriminator.set_acc_on(True)
  
          # train discriminator on data
          y_data = self.fprop_dis(x)
          delta_data = self.cost.costfunc.bprop_data(y_data)
          self.bprop_dis(delta_data)
          self.optimizer.optimize(
              self.layers.discriminator.layers_to_optimize, epoch=epoch
          )
          self.layers.discriminator.set_acc_on(False)
  
          # keep GAN cost values for the current minibatch
          # abuses get_cost(y,t) using y_noise as the "target"
          self.cost_dis[:] = self.cost.get_cost(
              y_data, y_temp, cost_type="dis"
          )
  
          # train generator
          if self.current_batch == self.last_gen_batch + self.get_k(
              self.gen_iter
          ):
              self.fill_noise(z, normal=(self.noise_type == "normal"))
              Gz = self.fprop_gen(z)
              y_temp[:] = y_data
              y_noise = self.fprop_dis(Gz)
              delta_noise = self.cost.costfunc.bprop_generator(y_noise)
              delta_dis = self.bprop_dis(delta_noise)
              self.bprop_gen(delta_dis)
              self.optimizer.optimize(
                  self.layers.generator.layers_to_optimize, epoch=epoch
              )
              # keep GAN cost values for the current minibatch
              self.cost_dis[:] = self.cost.get_cost(
                  y_temp, y_noise, cost_type="dis"
              )
              # accumulate total cost.
              self.total_cost[:] = self.total_cost + self.cost_dis
              self.last_gen_batch = self.current_batch
              self.gen_iter += 1
  
          self.be.end(Block.minibatch, mb_idx)
          callbacks.on_minibatch_end(epoch, mb_idx)
          self.current_batch += 1
  
      # now we divide total cost by the number of generator iterations,
      # so it was never total cost, but sum of averages
      # across all the minibatches we trained on the generator
      assert (
          self.gen_iter > last_gen_iter
      ), "at least one generator iteration is required for total cost estimation in this epoch"
      self.total_cost[:] = self.total_cost / (
          self.gen_iter - last_gen_iter
      )
  
      # Package a batch of data for plotting
      self.data_batch, self.noise_batch = x, self.fprop_gen(self.z0)
  
imports: from __future__ import division, print_function
  from builtins import str, zip
  from collections import OrderedDict
  import logging
  from neon import __version__
  from neon import NervanaObject, logger
  from neon.backends.backend import Block
  from neon.transforms import CrossEntropyBinary, Logistic
  from neon.util.persist import load_obj, save_obj, load_class
  from neon.util.modeldesc import ModelDescription
  from neon.layers import Sequential, Activation
  from neon.layers.container import DeltasTree, SkipThought
  from neon.util.beamsearch import BeamSearch
  from neon.optimizers.optimizer import get_param_list
  import numpy
label_desc: Use image node_id 6 for calling the GAN obj's underlying member method code with example usage: obj._epoch_fit(dataset, callbacks) without return types