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: Loads per layer (weights, states) and other model parameters from the
  dictionary passed.
  
  Arguments:
      model_dict (dict): dictionary describing the model including layers,
                         cost, optimizers, backend settings, etc.
                         generated by the serialize function
      data (NervanaDataIterator):   Data set (ignored, will be removed)
      load_states (bool):  if False, then only the weights will be loaded
                           into a model in which the layers have already been
                           created, otherwise will (re)create the layers from
                           the serialized parameters and set the learning
                           states as well
docstr_tok: ["Loads","per","layer","(","weights",",","states",")","and","other","model","parameters","from","the","dictionary","passed",".","Arguments",":","model_dict","(","dict",")",":","dictionary","describing","the","model","including","layers",",","cost",",","optimizers",",","backend","settings",",","etc",".","generated","by","the","serialize","function","data","(","NervanaDataIterator",")",":","Data","set","(","ignored",",","will","be","removed",")","load_states","(","bool",")",":","if","False",",","then","only","the","weights","will","be","loaded","into","a","model","in","which","the","layers","have","already","been","created",",","otherwise","will","(","re",")","create","the","layers","from","the","serialized","parameters","and","set","the","learning","states","as","well"]
code: def deserialize(self, model_dict, data=None, load_states=True):
      """
      Loads per layer (weights, states) and other model parameters from the
      dictionary passed.
  
      Arguments:
          model_dict (dict): dictionary describing the model including layers,
                             cost, optimizers, backend settings, etc.
                             generated by the serialize function
          data (NervanaDataIterator):   Data set (ignored, will be removed)
          load_states (bool):  if False, then only the weights will be loaded
                               into a model in which the layers have already been
                               created, otherwise will (re)create the layers from
                               the serialized parameters and set the learning
                               states as well
      """
  
      if data is not None:
          logger.warning(
              "data is a deprecated argument and will be ignored"
          )
  
      if "epoch_index" in model_dict:
          self.epoch_index = model_dict["epoch_index"]
      if "model" not in model_dict:
          logger.error(
              "Using old model serialization format. "
              "Serialized the model into new format"
          )
  
          param_layers = [l for l in self.layers_to_optimize]
          param_dict_list = model_dict["layer_params_states"]
          for l, ps in zip(param_layers, param_dict_list):
              l.set_params(ps)
              if "states" in ps and load_states:
                  l.set_states(ps)
          return
  
      if "backend" in model_dict:
          if "compat_mode" in model_dict["backend"]:
              self.be.compat_mode = model_dict["backend"]["compat_mode"]
      else:
          model_dict["backend"] = {}
  
      typ = model_dict["model"]["type"]
      main_container = load_class(typ)
  
      if not hasattr(self, "layers"):
          self.layers = main_container.gen_class(
              model_dict["model"]["config"]
          )
  
      self.layers.load_weights(model_dict["model"], load_states)
  
      if load_states and "rng_state" in model_dict["backend"]:
          try:
              self.be.rng_set_state(model_dict["backend"]["rng_state"])
          except ValueError as e:
              # could come about when switching backend types (ex GPU to CPU)
              logger.warning(
                  "Problems restoring existing RNG state: %s", str(e)
              )
  
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 18 for calling the Model obj's underlying member method code with example usage: obj.deserialize(model_dict, data, load_states) without return types