aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/c/c_api_internal.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-06-27 14:06:20 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-27 14:10:47 -0700
commit1f624e529d245cc2cd104d70971fe6a53d1616d6 (patch)
treebd0cd8f30a6902dee417c740a48b3057f2bba18f /tensorflow/c/c_api_internal.h
parent59ae0c0f9ac654bd668fb633feef3dbe26bae8ee (diff)
Moves TensorCApi from c_api.cc to c_api_internal.h, where it can be used
by other code that require access to the underlying TensorBuffers. PiperOrigin-RevId: 160323362
Diffstat (limited to 'tensorflow/c/c_api_internal.h')
-rw-r--r--tensorflow/c/c_api_internal.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/tensorflow/c/c_api_internal.h b/tensorflow/c/c_api_internal.h
index f17ac26ad9..f2773ae20f 100644
--- a/tensorflow/c/c_api_internal.h
+++ b/tensorflow/c/c_api_internal.h
@@ -117,3 +117,16 @@ struct TF_ImportGraphDefOptions {
struct TF_DeviceList {
std::vector<tensorflow::DeviceAttributes> response;
};
+
+namespace tensorflow {
+
+class TensorCApi {
+ public:
+ static TensorBuffer* Buffer(const Tensor& tensor) { return tensor.buf_; }
+ static Tensor MakeTensor(TF_DataType type, const TensorShape& shape,
+ TensorBuffer* buf) {
+ return Tensor(static_cast<DataType>(type), shape, buf);
+ }
+};
+
+} // end namespace tensorflow