diff options
author | 2017-06-09 08:36:13 -0700 | |
---|---|---|
committer | 2017-06-09 08:39:51 -0700 | |
commit | cade141580c76b41ba71bdc4b019722e674ab954 (patch) | |
tree | 37ac63b17f1993599dc0d4bad264bb4ccfc3ef8f /tensorflow/core/framework/tensor_shape.h | |
parent | 0a667240282f6215b36811475245509254d0127e (diff) |
Update internal SparseTensor C++ implementation to use a vector of int64.
The current behavior, which relies on a TensorShape to store the dense shape,
can lead to CHECK failures if a SparseTensor is created with a dense_shape that is
too lare.
PiperOrigin-RevId: 158521473
Diffstat (limited to 'tensorflow/core/framework/tensor_shape.h')
-rw-r--r-- | tensorflow/core/framework/tensor_shape.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/core/framework/tensor_shape.h b/tensorflow/core/framework/tensor_shape.h index 30297223cc..b201607461 100644 --- a/tensorflow/core/framework/tensor_shape.h +++ b/tensorflow/core/framework/tensor_shape.h @@ -367,6 +367,11 @@ class TensorShapeUtils { /// \brief Returns true iff `shape` ends with `suffix`. static bool EndsWith(const TensorShape& shape, const TensorShape& suffix); + + /// \brief Returns the product of values in an int64 array, + /// or a failing Status if the array represents a value larger than + /// a `TensorShape` can hold. + static Status NumElements(gtl::ArraySlice<int64> shape, int64* num_elements); }; /// Manages the partially known dimensions of a Tensor and their sizes. |