MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / load

Function load

tensorflow/python/saved_model/loader_impl.py:245–269  ·  view source on GitHub ↗

Loads the model from a SavedModel as specified by tags. Args: sess: The TensorFlow session to restore the variables. tags: Set of string tags to identify the required MetaGraphDef. These should correspond to the tags used when saving the variables using the SavedModel `sav

(sess, tags, export_dir, import_scope=None, **saver_kwargs)

Source from the content-addressed store, hash-verified

243 "tf.compat.v1.saved_model.load. There will be a new function for importing "
244 "SavedModels in Tensorflow 2.0.")
245def load(sess, tags, export_dir, import_scope=None, **saver_kwargs):
246 """Loads the model from a SavedModel as specified by tags.
247
248 Args:
249 sess: The TensorFlow session to restore the variables.
250 tags: Set of string tags to identify the required MetaGraphDef. These should
251 correspond to the tags used when saving the variables using the
252 SavedModel `save()` API.
253 export_dir: Directory in which the SavedModel protocol buffer and variables
254 to be loaded are located.
255 import_scope: Optional `string` -- if specified, prepend this string
256 followed by '/' to all loaded tensor names. This scope is applied to
257 tensor instances loaded into the passed session, but it is *not* written
258 through to the static `MetaGraphDef` protocol buffer that is returned.
259 **saver_kwargs: Optional keyword arguments passed through to Saver.
260
261 Returns:
262 The `MetaGraphDef` protocol buffer loaded in the provided session. This
263 can be used to further extract signature-defs, collection-defs, etc.
264
265 Raises:
266 RuntimeError: MetaGraphDef associated with the tags cannot be found.
267 """
268 loader = SavedModelLoader(export_dir)
269 return loader.load(sess, tags, import_scope, **saver_kwargs)
270
271
272class SavedModelLoader(object):

Callers

nothing calls this directly

Calls 2

loadMethod · 0.95
SavedModelLoaderClass · 0.85

Tested by

no test coverage detected