class_docstr: Class which stores a list of layers describing the model. Can train the layer
  weights on a dataset, evaluate on a test set and serialize the model.
  Additional functionality can be added to the fit method through callback functions.
  
  Arguments:
      layers: layer container, a list of layers (that will be containerized),
              or a serialized model description
      dataset (NervanaDataIterator): Data set (ignored, will be removed)
      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)
class_docstr_tok: ["Class","which","stores","a","list","of","layers","describing","the","model",".","Can","train","the","layer","weights","on","a","dataset",",","evaluate","on","a","test","set","and","serialize","the","model",".","Additional","functionality","can","be","added","to","the","fit","method","through","callback","functions",".","Arguments",":","layers",":","layer","container",",","a","list","of","layers","(","that","will","be","containerized",")",",","or","a","serialized","model","description","dataset","(","NervanaDataIterator",")",":","Data","set","(","ignored",",","will","be","removed",")","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",")"]
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
      # iterate through minibatches of the dataset
      for mb_idx, (x, t) in enumerate(dataset):
          callbacks.on_minibatch_begin(epoch, mb_idx)
          self.be.begin(Block.minibatch, mb_idx)
  
          x = self.fprop(x)
  
          self.total_cost[:] = self.total_cost + self.cost.get_cost(
              x, t
          )
  
          # deltas back propagate through layers
          # for every layer in reverse except the 0th one
          delta = self.cost.get_errors(x, t)
  
          self.bprop(delta)
          self.optimizer.optimize(self.layers_to_optimize, epoch=epoch)
  
          self.be.end(Block.minibatch, mb_idx)
          callbacks.on_minibatch_end(epoch, mb_idx)
  
      # now we divide total cost by the number of batches,
      # so it was never total cost, but sum of averages
      # across all the minibatches we trained on
      self.total_cost[:] = self.total_cost / dataset.nbatches
  
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 8 for calling the Model obj's underlying member method code with example usage: obj._epoch_fit(dataset, callbacks) without return types