diff options
author | 2017-04-13 09:30:19 -0800 | |
---|---|---|
committer | 2017-04-13 10:44:47 -0700 | |
commit | a16db8302a2436d915dcb551d0a7b537025e2f35 (patch) | |
tree | f129b4be92f04c49d02d7c46f17fbbe6698ebfaa /tensorflow/c/c_api_test.cc | |
parent | 7d4aaddaad9343fea73dbc0e100e8c5d726f45d6 (diff) |
C API: fix misnamed function in c_api.h
TF_ImportGraphDefOptionsRemapControlDependency() was accidentally
called TF_GraphImportGraphDefOptionsRemapControlDependency() in the
header file. This change is technically a breaking change to the public
API, but given that the public function was never defined it seems ok
to change it to the intended name. This change also adds a test for
TF_ImportGraphDefOptionsRemapControlDependency(), which was missing
before, allowing this to happen.
Change: 153075645
Diffstat (limited to 'tensorflow/c/c_api_test.cc')
-rw-r--r-- | tensorflow/c/c_api_test.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tensorflow/c/c_api_test.cc b/tensorflow/c/c_api_test.cc index 32143f4f2f..d846daa71b 100644 --- a/tensorflow/c/c_api_test.cc +++ b/tensorflow/c/c_api_test.cc @@ -821,6 +821,33 @@ TEST(CAPI, ImportGraphDef) { EXPECT_EQ(feed, control_inputs[0]); EXPECT_EQ(feed2, control_inputs[1]); + // Export to a graph def so we can import a graph with control dependencies + TF_DeleteBuffer(graph_def); + graph_def = TF_NewBuffer(); + TF_GraphToGraphDef(graph, graph_def, s); + ASSERT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s); + + // Import again, with remapped control dependency, into the same graph + TF_DeleteImportGraphDefOptions(opts); + opts = TF_NewImportGraphDefOptions(); + TF_ImportGraphDefOptionsSetPrefix(opts, "imported4"); + TF_ImportGraphDefOptionsRemapControlDependency(opts, "imported/feed", feed); + TF_GraphImportGraphDef(graph, graph_def, opts, s); + ASSERT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s); + + TF_Operation* scalar4 = + TF_GraphOperationByName(graph, "imported4/imported3/scalar"); + TF_Operation* feed4 = + TF_GraphOperationByName(graph, "imported4/imported2/feed"); + + // Check that imported `imported3/scalar` has remapped control dep from + // original graph and imported control dep + num_control_inputs = TF_OperationGetControlInputs( + scalar4, control_inputs, TF_OperationNumControlInputs(scalar4)); + ASSERT_EQ(2, num_control_inputs); + EXPECT_EQ(feed, control_inputs[0]); + EXPECT_EQ(feed4, control_inputs[1]); + TF_DeleteImportGraphDefOptions(opts); TF_DeleteBuffer(graph_def); |