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

Method partial_run

tensorflow/python/client/session.py:976–1021  ·  view source on GitHub ↗

Continues the execution with more feeds and fetches. This is EXPERIMENTAL and subject to change. To use partial execution, a user first calls `partial_run_setup()` and then a sequence of `partial_run()`. `partial_run_setup` specifies the list of feeds and fetches that will be used

(self, handle, fetches, feed_dict=None)

Source from the content-addressed store, hash-verified

974 return result
975
976 def partial_run(self, handle, fetches, feed_dict=None):
977 """Continues the execution with more feeds and fetches.
978
979 This is EXPERIMENTAL and subject to change.
980
981 To use partial execution, a user first calls `partial_run_setup()` and
982 then a sequence of `partial_run()`. `partial_run_setup` specifies the
983 list of feeds and fetches that will be used in the subsequent
984 `partial_run` calls.
985
986 The optional `feed_dict` argument allows the caller to override
987 the value of tensors in the graph. See run() for more information.
988
989 Below is a simple example:
990
991 ```python
992 a = array_ops.placeholder(dtypes.float32, shape=[])
993 b = array_ops.placeholder(dtypes.float32, shape=[])
994 c = array_ops.placeholder(dtypes.float32, shape=[])
995 r1 = math_ops.add(a, b)
996 r2 = math_ops.multiply(r1, c)
997
998 h = sess.partial_run_setup([r1, r2], [a, b, c])
999 res = sess.partial_run(h, r1, feed_dict={a: 1, b: 2})
1000 res = sess.partial_run(h, r2, feed_dict={c: res})
1001 ```
1002
1003 Args:
1004 handle: A handle for a sequence of partial runs.
1005 fetches: A single graph element, a list of graph elements, or a dictionary
1006 whose values are graph elements or lists of graph elements (see
1007 documentation for `run`).
1008 feed_dict: A dictionary that maps graph elements to values (described
1009 above).
1010
1011 Returns:
1012 Either a single value if `fetches` is a single graph element, or
1013 a list of values if `fetches` is a list, or a dictionary with the
1014 same keys as `fetches` if that is a dictionary
1015 (see documentation for `run`).
1016
1017 Raises:
1018 tf.errors.OpError: Or one of its subclasses on error.
1019 """
1020 # TODO(touts): Support feeding and fetching the same tensor.
1021 return self._run(handle, fetches, feed_dict, None, None)
1022
1023 def partial_run_setup(self, fetches, feeds=None):
1024 """Sets up a graph with feeds and fetches for partial run.

Calls 1

_runMethod · 0.95