aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/common_runtime/executor.h
diff options
context:
space:
mode:
authorGravatar Yuan Yu <yuanbyu@google.com>2016-04-10 08:46:36 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-04-10 09:51:54 -0700
commit098f930de4ef044021f3ef1d3cdd6848c23eddb0 (patch)
tree107b20a63c2c1f4069a804af84489b38e9899478 /tensorflow/core/common_runtime/executor.h
parentcc9560e8f449060feeaa73f47eb41e4d77079573 (diff)
This is another step to make TensorFlow more interactive and flexible to users. It allows a tensor produced by a run call to stay "in-place" so that a future run call can use it in-place. To achieve this, a run call can now return a handle of a tensor to the client, which can then be fed to a subsequent run call. This feature is complimentary to partial run, though there are some overlaps.
Here are a few properties of the current implementation: 1. Tensors are stored in the state of a session. The tensors are garbage collected if the client doesn't have a reference to the tensor or the session is closed. 2. There is no change to the current session API. We introduced two ops to manage the conversions between tensors and its handles. (There is a third op to garbage collect a tensor.) See the example below. 3. It fits quite well into the current feed-fetch design/implementation. It tries to reuse the graph (and caches) as much as possible so to make things efficient. Below is a simple example. More examples can be found in sessopn_ops_test.py. # Return a handle. a = tf.constant(10) b = tf.constant(5) c = tf.mul(a, b) h = tf.get_session_handle(c).eval() # Feed a tensor handle. f, x = tf.get_session_tensor(dtypes.int32) y = tf.mul(x, 10) result = sess.run(y, feed_dict={f: h.handle}) # result == 500 Change: 119481352
Diffstat (limited to 'tensorflow/core/common_runtime/executor.h')
-rw-r--r--tensorflow/core/common_runtime/executor.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/core/common_runtime/executor.h b/tensorflow/core/common_runtime/executor.h
index 1d4972d04d..b013927980 100644
--- a/tensorflow/core/common_runtime/executor.h
+++ b/tensorflow/core/common_runtime/executor.h
@@ -18,6 +18,7 @@ limitations under the License.
#include "tensorflow/core/common_runtime/device.h"
#include "tensorflow/core/framework/rendezvous.h"
+#include "tensorflow/core/framework/session_state.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/graph/graph.h"
#include "tensorflow/core/lib/core/notification.h"
@@ -85,6 +86,8 @@ class Executor {
StepStatsCollector* stats_collector = nullptr;
FunctionCallFrame* call_frame = nullptr;
CancellationManager* cancellation_manager = nullptr;
+ SessionState* session_state = nullptr;
+ TensorStore* tensor_store = nullptr;
typedef std::function<void()> Closure;
typedef std::function<void(Closure)> Runner;