parameters: (cls, path, config=None)
return_statement: return result
docstring: Restores model from give path.
  
      Args:
        path: Path to the checkpoints and other model information.
        config: RunConfig object that controls the configurations of the session,
          e.g. num_cores, gpu_memory_fraction, etc. This is allowed to be
            reconfigured.
  
      Returns:
        Estimator, object of the subclass of TensorFlowEstimator.
  
      Raises:
        ValueError: if `path` does not contain a model definition.
docstring_summary: Restores model from give path.
docstring_tokens: Restores model from give path .
function: def restore(cls, path, config=None):
      # pylint: disable=unused-argument
      """Restores model from give path.
  
      Args:
        path: Path to the checkpoints and other model information.
        config: RunConfig object that controls the configurations of the session,
          e.g. num_cores, gpu_memory_fraction, etc. This is allowed to be
            reconfigured.
  
      Returns:
        Estimator, object of the subclass of TensorFlowEstimator.
  
      Raises:
        ValueError: if `path` does not contain a model definition.
      """
      model_def_filename = os.path.join(path, 'model.def')
      if not os.path.exists(model_def_filename):
        raise ValueError("Restore folder doesn't contain model definition.")
      # list of parameters that are allowed to be reconfigured
      reconfigurable_params = ['_config']
      _config = config  # pylint: disable=unused-variable,invalid-name
      with gfile.Open(model_def_filename) as fmodel:
        model_def = json.loads(fmodel.read())
        # TensorFlow binding requires parameters to be strings not unicode.
        # Only issue in Python2.
        for key, value in model_def.items():
          if isinstance(value, string_types) and not isinstance(value, str):
            model_def[key] = str(value)
          if key in reconfigurable_params:
            new_value = locals()[key]
            if new_value is not None:
              model_def[key] = new_value
  
      class_name = model_def.pop('class_name')
      if class_name == 'TensorFlowEstimator':
        custom_estimator = TensorFlowEstimator(model_fn=None, **model_def)
        # pylint: disable=protected-access
        custom_estimator._restore(path)
        return custom_estimator
  
      # To avoid cyclical dependencies, import inside the function instead of
      # the beginning of the file.
      # pylint: disable=g-import-not-at-top
      from tensorflow.contrib.learn.python.learn import estimators
      # Estimator must be one of the defined estimators in the __init__ file.
      result = getattr(estimators, class_name)(**model_def)
      # pylint: disable=protected-access
      result._restore(path)
      return result
function_tokens: def restore ( cls , path , config = None ) : # pylint: disable=unused-argument model_def_filename = os . path . join ( path , 'model.def' ) if not os . path . exists ( model_def_filename ) : raise ValueError ( "Restore folder doesn't contain model definition." ) # list of parameters that are allowed to be reconfigured reconfigurable_params = [ '_config' ] _config = config # pylint: disable=unused-variable,invalid-name with gfile . Open ( model_def_filename ) as fmodel : model_def = json . loads ( fmodel . read ( ) ) # TensorFlow binding requires parameters to be strings not unicode. # Only issue in Python2. for key , value in model_def . items ( ) : if isinstance ( value , string_types ) and not isinstance ( value , str ) : model_def [ key ] = str ( value ) if key in reconfigurable_params : new_value = locals ( ) [ key ] if new_value is not None : model_def [ key ] = new_value class_name = model_def . pop ( 'class_name' ) if class_name == 'TensorFlowEstimator' : custom_estimator = TensorFlowEstimator ( model_fn = None , * * model_def ) # pylint: disable=protected-access custom_estimator . _restore ( path ) return custom_estimator # To avoid cyclical dependencies, import inside the function instead of # the beginning of the file. # pylint: disable=g-import-not-at-top from tensorflow . contrib . learn . python . learn import estimators # Estimator must be one of the defined estimators in the __init__ file. result = getattr ( estimators , class_name ) ( * * model_def ) # pylint: disable=protected-access result . _restore ( path ) return result