aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/graph/graph.cc
diff options
context:
space:
mode:
authorGravatar Shanqing Cai <cais@google.com>2017-03-09 11:13:46 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-09 11:30:12 -0800
commitcdecf416365c85f8274393e097ecab163cbea7c3 (patch)
tree5c57b539c5dba68678c22f2cbdf7da91c5c822cd /tensorflow/core/graph/graph.cc
parenta62ed13bf366cb1a99183f93c859b6786f9d3070 (diff)
Enable the direct use of TensorHandles as feed values through ResourceHandles
This is motivated by, among other goals, the need to enhance memory efficiency during TFDBG's stepper operations. The stepper caches TensorHandles to already-continued-to tensors and use them as feeds if later continue-to actions depend on the tensors as transitive inputs. However, previously the TensorHandles had to be converted to Numpy arrays by calling eval() and the Numpy arrays were then fed back to next Session.run() calls. This mode of operation involved at least two unnecessary tensor-numpy and numpy-tensor copying. This CL makes it possible to use the ResourceHandle representations TensorHandles directly as feed values, eliminating the need for the aforementioned copying. To this end, the following changes are made 1) the underlying representations of TensorHandles are changed from string to ResourceHandle. A custom numpy struct type is created to allow ResourceHandle of the TensorHandle subtype to be fed during Session.run() calls. 2) added GetSessionHandleOpV2, which deprecates GetSessionHandleOp. The V2 op outputs a DT_RESOURCE Tensor, instead of a string Tensor in the deprecated version. Change: 149672538
Diffstat (limited to 'tensorflow/core/graph/graph.cc')
-rw-r--r--tensorflow/core/graph/graph.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc
index 509c67c11f..6d9b114e90 100644
--- a/tensorflow/core/graph/graph.cc
+++ b/tensorflow/core/graph/graph.cc
@@ -98,6 +98,7 @@ void Node::Initialize(int id, int cost_id, Properties* props) {
SET_CLASS(NC_VARIABLE, ts, "VariableV2", "");
SET_CLASS(NC_IDENTITY, ts, "Identity", "RefIdentity");
SET_CLASS(NC_GET_SESSION_HANDLE, ts, "GetSessionHandle", "");
+ SET_CLASS(NC_GET_SESSION_HANDLE, ts, "GetSessionHandleV2", "");
SET_CLASS(NC_GET_SESSION_TENSOR, ts, "GetSessionTensor", "");
SET_CLASS(NC_DELETE_SESSION_TENSOR, ts, "DeleteSessionTensor", "");
if (class_ == NC_UNINITIALIZED) {