Load the MetaGraphDef graph and restore variable values into the session. Args: sess: tf.compat.v1.Session to restore variable values. tags: a set of string tags identifying a MetaGraphDef. import_scope: Optional `string` -- if specified, prepend this string followed b
(self, sess, tags, import_scope=None, **saver_kwargs)
| 403 | sess.run(fetches=[init_op], feed_dict=asset_tensors_dictionary) |
| 404 | |
| 405 | def load(self, sess, tags, import_scope=None, **saver_kwargs): |
| 406 | """Load the MetaGraphDef graph and restore variable values into the session. |
| 407 | |
| 408 | Args: |
| 409 | sess: tf.compat.v1.Session to restore variable values. |
| 410 | tags: a set of string tags identifying a MetaGraphDef. |
| 411 | import_scope: Optional `string` -- if specified, prepend this string |
| 412 | followed by '/' to all loaded tensor names. This scope is applied to |
| 413 | tensor instances loaded into the passed session, but it is *not* written |
| 414 | through to the static `MetaGraphDef` protocol buffer that is returned. |
| 415 | **saver_kwargs: keyword arguments to pass to tf.train.import_meta_graph. |
| 416 | |
| 417 | Returns: |
| 418 | `MetagraphDef` proto of the graph that was loaded. |
| 419 | """ |
| 420 | with sess.graph.as_default(): |
| 421 | saver, _ = self.load_graph(sess.graph, tags, import_scope, |
| 422 | **saver_kwargs) |
| 423 | self.restore_variables(sess, saver, import_scope) |
| 424 | self.run_init_ops(sess, tags, import_scope) |
| 425 | return self.get_meta_graph_def_from_tags(tags) |