|
| 1 | +diff --git a/tensorflow/c/c_api.cc b/tensorflow/c/c_api.cc |
| 2 | +index f3bf7b98a1e..4d4cd1b1fe1 100644 |
| 3 | +--- a/tensorflow/c/c_api.cc |
| 4 | ++++ b/tensorflow/c/c_api.cc |
| 5 | +@@ -645,12 +645,12 @@ TF_DEVICELIST_METHOD(uint64_t, TF_DeviceListIncarnation, incarnation(), 0); |
| 6 | + |
| 7 | + // Helper functions ----------------------------------------------------------- |
| 8 | + |
| 9 | +-namespace { |
| 10 | +- |
| 11 | + TF_Operation* ToOperation(Node* node) { |
| 12 | + return static_cast<TF_Operation*>(static_cast<void*>(node)); |
| 13 | + } |
| 14 | + |
| 15 | ++namespace { |
| 16 | ++ |
| 17 | + string OutputName(const TF_Output& output) { |
| 18 | + return StrCat(output.oper->node.name(), ":", output.index); |
| 19 | + } |
| 20 | +@@ -782,7 +782,7 @@ void TF_GraphGetTensorShape(TF_Graph* graph, TF_Output output, int64_t* dims, |
| 21 | + |
| 22 | + extern "C" { |
| 23 | + |
| 24 | +-static TF_OperationDescription* TF_NewOperationLocked(TF_Graph* graph, |
| 25 | ++TF_OperationDescription* TF_NewOperationLocked(TF_Graph* graph, |
| 26 | + const char* op_type, |
| 27 | + const char* oper_name) |
| 28 | + TF_EXCLUSIVE_LOCKS_REQUIRED(graph->mu) { |
| 29 | +@@ -1041,7 +1041,7 @@ void TF_SetAttrValueProto(TF_OperationDescription* desc, const char* attr_name, |
| 30 | + status->status = Status::OK(); |
| 31 | + } |
| 32 | + |
| 33 | +-static TF_Operation* TF_FinishOperationLocked(TF_OperationDescription* desc, |
| 34 | ++TF_Operation* TF_FinishOperationLocked(TF_OperationDescription* desc, |
| 35 | + TF_Status* status) |
| 36 | + TF_EXCLUSIVE_LOCKS_REQUIRED(desc->graph->mu) { |
| 37 | + Node* ret = nullptr; |
| 38 | +diff --git a/tensorflow/c/c_api.h b/tensorflow/c/c_api.h |
| 39 | +index 705cf85e051..d38ae62e86a 100644 |
| 40 | +--- a/tensorflow/c/c_api.h |
| 41 | ++++ b/tensorflow/c/c_api.h |
| 42 | +@@ -255,6 +255,10 @@ TF_CAPI_EXPORT extern void TF_GraphGetTensorShape(TF_Graph* graph, |
| 43 | + int64_t* dims, int num_dims, |
| 44 | + TF_Status* status); |
| 45 | + |
| 46 | ++TF_OperationDescription* TF_NewOperationLocked(TF_Graph* graph, |
| 47 | ++ const char* op_type, |
| 48 | ++ const char* oper_name); |
| 49 | ++ |
| 50 | + // Operation will only be added to *graph when TF_FinishOperation() is |
| 51 | + // called (assuming TF_FinishOperation() does not return an error). |
| 52 | + // *graph must not be deleted until after TF_FinishOperation() is |
| 53 | +@@ -406,6 +410,9 @@ TF_CAPI_EXPORT extern void TF_SetAttrValueProto(TF_OperationDescription* desc, |
| 54 | + size_t proto_len, |
| 55 | + TF_Status* status); |
| 56 | + |
| 57 | ++TF_Operation* TF_FinishOperationLocked(TF_OperationDescription* desc, |
| 58 | ++ TF_Status* status); |
| 59 | ++ |
| 60 | + // If this function succeeds: |
| 61 | + // * *status is set to an OK value, |
| 62 | + // * a TF_Operation is added to the graph, |
| 63 | +diff --git a/tensorflow/c/c_api_internal.h b/tensorflow/c/c_api_internal.h |
| 64 | +index 76345cf068c..904f083a2d9 100644 |
| 65 | +--- a/tensorflow/c/c_api_internal.h |
| 66 | ++++ b/tensorflow/c/c_api_internal.h |
| 67 | +@@ -185,6 +185,12 @@ struct TF_Server { |
| 68 | + }; |
| 69 | + #endif // !defined(IS_MOBILE_PLATFORM) && !defined(IS_SLIM_BUILD) |
| 70 | + |
| 71 | ++// Exposed helper functions |
| 72 | ++ |
| 73 | ++TF_Operation* ToOperation(tensorflow::Node* node); |
| 74 | ++ |
| 75 | ++// End Exposed helper functions |
| 76 | ++ |
| 77 | + namespace tensorflow { |
| 78 | + |
| 79 | + Status MessageToBuffer(const tensorflow::protobuf::MessageLite& in, |
| 80 | +-- |
| 81 | +2.17.1 |
| 82 | + |
0 commit comments