diff --git a/tensorflow/core/framework/tensor.h b/tensorflow/core/framework/tensor.h index 54541be0b4f..744a14e007e 100644 --- a/tensorflow/core/framework/tensor.h +++ b/tensorflow/core/framework/tensor.h @@ -18,6 +18,7 @@ limitations under the License. #include #include + #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" #include "tensorflow/core/framework/allocator.h" #include "tensorflow/core/framework/tensor_shape.h" @@ -239,6 +240,12 @@ class Tensor { /// are not valid. Tensor(Tensor&& other); + // Explicitly delete constructor that take a pointer (except char*) + // so that the pointer doesn't get implicitly cast to bool. + template ::value, + T>::type* = nullptr> + explicit Tensor(T* t) = delete; + ~Tensor(); /// Returns the data type.