parameters: (self)
docstring: Load state from checkpoint into the deserialized objects.
docstring_summary: Load state from checkpoint into the deserialized objects.
docstring_tokens: Load state from checkpoint into the deserialized objects .
function: def _restore_checkpoint(self):
      """Load state from checkpoint into the deserialized objects."""
      variables_path = saved_model_utils.get_variables_path(self._export_dir)
      # TODO(andresp): Clean use of private methods of TrackableSaver.
      # pylint: disable=protected-access
      saver = util.TrackableSaver(graph_view.ObjectGraphView(self.get(0)))
      with ops.device("CPU"):
        saver._file_prefix_placeholder = constant_op.constant(variables_path)
      load_status = saver.restore(variables_path)
      load_status.assert_existing_objects_matched()
      checkpoint = load_status._checkpoint
  
      # When running in eager mode, the `restore` call above has already run and
      # restored the state of trackables, call `position.restore_ops()` will
      # return an empty list as there is nothing left to do. In graph mode, that
      # will return the list of ops that must run to restore the object on that
      # position. We have to wire them in the initializers of the objects so that
      # they get initialized properly when using common practices (e.g. the ones
      # used by ManagedSession) without further user action.
      for object_id, obj in dict(checkpoint.object_by_proto_id).items():
        position = base.CheckpointPosition(checkpoint=checkpoint,
                                           proto_id=object_id)
        restore_ops = position.restore_ops()
        if restore_ops:
          if resource_variable_ops.is_resource_variable(obj):
            obj._initializer_op = restore_ops
          else:
            raise NotImplementedError(
                ("Missing functionality to restore state of object "
                 "%r from the checkpoint." % obj))
function_tokens: def _restore_checkpoint ( self ) : variables_path = saved_model_utils . get_variables_path ( self . _export_dir ) # TODO(andresp): Clean use of private methods of TrackableSaver. # pylint: disable=protected-access saver = util . TrackableSaver ( graph_view . ObjectGraphView ( self . get ( 0 ) ) ) with ops . device ( "CPU" ) : saver . _file_prefix_placeholder = constant_op . constant ( variables_path ) load_status = saver . restore ( variables_path ) load_status . assert_existing_objects_matched ( ) checkpoint = load_status . _checkpoint # When running in eager mode, the `restore` call above has already run and # restored the state of trackables, call `position.restore_ops()` will # return an empty list as there is nothing left to do. In graph mode, that # will return the list of ops that must run to restore the object on that # position. We have to wire them in the initializers of the objects so that # they get initialized properly when using common practices (e.g. the ones # used by ManagedSession) without further user action. for object_id , obj in dict ( checkpoint . object_by_proto_id ) . items ( ) : position = base . CheckpointPosition ( checkpoint = checkpoint , proto_id = object_id ) restore_ops = position . restore_ops ( ) if restore_ops : if resource_variable_ops . is_resource_variable ( obj ) : obj . _initializer_op = restore_ops else : raise NotImplementedError ( ( "Missing functionality to restore state of object " "%r from the checkpoint." % obj ) )