aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/c/c_api.h
diff options
context:
space:
mode:
authorGravatar Asim Shankar <ashankar@google.com>2018-02-08 13:17:53 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-08 13:22:08 -0800
commitcaced55cbc205a9423a480cae0bb9e7a9a10f3a1 (patch)
tree392754e09b8e28225707da44d38a5ffc006c72c2 /tensorflow/c/c_api.h
parent785ac4418d60e3f69115c2a05ee989d620635a71 (diff)
C API: Fixes #7394
Ideally, when TF_NewTensor is provided with invalid arguments it would provide a detailed error message. However, for now, to keep the existing API, signal failure by returning nullptr. PiperOrigin-RevId: 185040858
Diffstat (limited to 'tensorflow/c/c_api.h')
-rw-r--r--tensorflow/c/c_api.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/c/c_api.h b/tensorflow/c/c_api.h
index d2e45341bf..6d30905a1a 100644
--- a/tensorflow/c/c_api.h
+++ b/tensorflow/c/c_api.h
@@ -226,6 +226,10 @@ typedef struct TF_Tensor TF_Tensor;
// (*deallocator)(data, len, deallocator_arg)
// Clients must provide a custom deallocator function so they can pass in
// memory managed by something like numpy.
+//
+// May return NULL (and invoke the deallocator) if the provided data buffer
+// (data, len) is inconsistent with a tensor of the given TF_DataType
+// and the shape specified by (dima, num_dims).
TF_CAPI_EXPORT extern TF_Tensor* TF_NewTensor(
TF_DataType, const int64_t* dims, int num_dims, void* data, size_t len,
void (*deallocator)(void* data, size_t len, void* arg),