aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/lib/core
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/lib/core')
-rw-r--r--tensorflow/python/lib/core/ndarray_tensor.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/tensorflow/python/lib/core/ndarray_tensor.cc b/tensorflow/python/lib/core/ndarray_tensor.cc
index 994af69386..a07e305ffb 100644
--- a/tensorflow/python/lib/core/ndarray_tensor.cc
+++ b/tensorflow/python/lib/core/ndarray_tensor.cc
@@ -267,7 +267,9 @@ gtl::InlinedVector<npy_intp, 4> GetPyArrayDimensionsForTensor(
const int ndims = TF_NumDims(tensor);
gtl::InlinedVector<npy_intp, 4> dims(ndims);
if (TF_TensorType(tensor) == TF_RESOURCE) {
- dims[0] = TF_TensorByteSize(tensor);
+ CHECK_EQ(ndims, 0)
+ << "Fetching of non-scalar resource tensors is not supported.";
+ dims.push_back(TF_TensorByteSize(tensor));
*nelems = dims[0];
} else {
*nelems = 1;