diff options
author | Igor Ganichev <iga@google.com> | 2017-08-19 10:25:30 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-08-19 10:29:34 -0700 |
commit | e1030858725b485b0f848cc27597b8e2c2d8383f (patch) | |
tree | 1bdfcf53434398a44bbe6ab42b8f2feb24cdbbc1 /tensorflow/c/while_loop_test.cc | |
parent | 181267c51f4827e351bb64a620b3dff83539bc11 (diff) |
Don't create cond_input and body_input nodes when finishing while loop
These nodes are not needed, but they caused failures in functions
with while loops because functions currently execute all ops in their
bodies and these ops are placeholders without feeds.
PiperOrigin-RevId: 165814802
Diffstat (limited to 'tensorflow/c/while_loop_test.cc')
-rw-r--r-- | tensorflow/c/while_loop_test.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tensorflow/c/while_loop_test.cc b/tensorflow/c/while_loop_test.cc index 7f7e362269..ce4f86bb25 100644 --- a/tensorflow/c/while_loop_test.cc +++ b/tensorflow/c/while_loop_test.cc @@ -174,6 +174,16 @@ TEST_F(CApiWhileLoopTest, BasicLoop) { EXPECT_TRUE(outputs_[1].oper != nullptr); EXPECT_GE(outputs_[1].index, 0); + // Check that cond and body inputs are not present + for (int i = 0; i < params_->ninputs; ++i) { + string cond_name = + ::tensorflow::strings::StrCat(params_->name, "/cond/cond_input", i); + string body_name = + ::tensorflow::strings::StrCat(params_->name, "/body/body_input", i); + EXPECT_TRUE(TF_GraphOperationByName(graph_, cond_name.c_str()) == nullptr); + EXPECT_TRUE(TF_GraphOperationByName(graph_, body_name.c_str()) == nullptr); + } + // Run the graph Run({-9, 2}); ExpectOutputValue(0, 3); |