diff options
author | Asim Shankar <ashankar@google.com> | 2016-11-09 08:21:50 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-11-09 08:41:53 -0800 |
commit | e580e721cc1a205cb4b7afe64bc6af4d775a4851 (patch) | |
tree | 04338afa9d4f905c632d084dd964261eae9b8668 /tensorflow/c/c_api_test.cc | |
parent | 988fec702bb0c23613cfd3ba76d04bf41c1a7c59 (diff) |
C API: Rename TF_SessionWithGraph to TF_Session.
This makes the preferred API for graph construction and
execution have the simpler, more sensible names (TF_Session,
TF_NewSession etc.) and the older one which we hope to
eventually remove have the more awkward ones (TF_DeprecatedSession,
TF_NewDeprecatedSession etc.)
Change: 138641615
Diffstat (limited to 'tensorflow/c/c_api_test.cc')
-rw-r--r-- | tensorflow/c/c_api_test.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tensorflow/c/c_api_test.cc b/tensorflow/c/c_api_test.cc index dec891fdc6..27a5a0991b 100644 --- a/tensorflow/c/c_api_test.cc +++ b/tensorflow/c/c_api_test.cc @@ -154,7 +154,7 @@ TEST(CAPI, SessionOptions) { TF_DeleteSessionOptions(opt); } -TEST(CAPI, SessionWithRunMetadata) { +TEST(CAPI, DeprecatedSession) { TF_Status* s = TF_NewStatus(); TF_SessionOptions* opt = TF_NewSessionOptions(); TF_DeprecatedSession* session = TF_NewDeprecatedSession(opt, s); @@ -687,15 +687,15 @@ TEST(CAPI, ImportGraphDef) { TF_DeleteStatus(s); } -class CSessionWithGraph { +class CSession { public: - CSessionWithGraph(TF_Graph* graph, TF_Status* s) { + CSession(TF_Graph* graph, TF_Status* s) { TF_SessionOptions* opts = TF_NewSessionOptions(); - session_ = TF_NewSessionWithGraph(graph, opts, s); + session_ = TF_NewSession(graph, opts, s); TF_DeleteSessionOptions(opts); } - ~CSessionWithGraph() { + ~CSession() { TF_Status* s = TF_NewStatus(); CloseAndDelete(s); EXPECT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s); @@ -758,9 +758,9 @@ class CSessionWithGraph { DeleteInputValues(); ResetOutputValues(); if (session_ != nullptr) { - TF_CloseSessionWithGraph(session_, s); + TF_CloseSession(session_, s); EXPECT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s); - TF_DeleteSessionWithGraph(session_, s); + TF_DeleteSession(session_, s); session_ = nullptr; } } @@ -782,7 +782,7 @@ class CSessionWithGraph { output_values_.clear(); } - TF_SessionWithGraph* session_; + TF_Session* session_; std::vector<TF_Port> inputs_; std::vector<TF_Tensor*> input_values_; std::vector<TF_Port> outputs_; @@ -790,7 +790,7 @@ class CSessionWithGraph { std::vector<TF_Operation*> targets_; }; -TEST(CAPI, SessionWithGraph) { +TEST(CAPI, Session) { TF_Status* s = TF_NewStatus(); TF_Graph* graph = TF_NewGraph(); @@ -807,7 +807,7 @@ TEST(CAPI, SessionWithGraph) { ASSERT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s); // Create a session for this graph. - CSessionWithGraph csession(graph, s); + CSession csession(graph, s); ASSERT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s); // Run the graph. @@ -1346,6 +1346,6 @@ TEST_F(CApiAttributesTest, Errors) { // * TF_SetDevice(desc, "/job:worker"); // * control inputs / outputs // * targets -// * TF_DeleteGraph() before TF_DeleteSessionWithGraph() +// * TF_DeleteGraph() before TF_DeleteSession() } // namespace |