aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/c/python_api.h
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2018-04-24 15:45:50 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-24 15:48:41 -0700
commite7db82f821a1c522eed9e0c633df8b3db26ef38d (patch)
treee18a1e5afcbe56831bbce78784e0f36161921aaa /tensorflow/c/python_api.h
parent184c8306a4a3d41f42f077b4898933500d61ce86 (diff)
Make TF functions work with _USE_C_SHAPES=True.
It turns out regular functions need to manually copy handle data in addition to eager GraphModeFunctions, so I moved the C extensions to python_api.h from eager/c_api.h. This also cleans up function_test.py to assume the C API is enabled. PiperOrigin-RevId: 194158700
Diffstat (limited to 'tensorflow/c/python_api.h')
-rw-r--r--tensorflow/c/python_api.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/tensorflow/c/python_api.h b/tensorflow/c/python_api.h
index 2d4c8cd9ed..4bcb5bde62 100644
--- a/tensorflow/c/python_api.h
+++ b/tensorflow/c/python_api.h
@@ -55,9 +55,15 @@ void ExtendSession(TF_Session* session, TF_Status* status);
// Returns the serialized CppShapeInferenceResult::HandleData proto for
// `output` if its a resource tensor, or otherwise returns the empty string.
-// TODO(b/74620627): remove when _USE_C_SHAPES is removed
-std::string ResourceHandleShapeAndType(TF_Graph* graph, TF_Output output);
-
+std::string GetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output);
+
+// Sets `output` based on `proto`, which should be a serialized
+// CppShapeInferenceResult::HandleData proto.
+// NOTE(skyewm): `proto` is passed a void*/size_t pair instead of a std::string
+// because I couldn't get SWIG to work otherwise.
+void SetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output,
+ const void* proto, size_t proto_len,
+ TF_Status* status);
} // namespace tensorflow
#endif // TENSORFLOW_C_PYTHON_API_H_