From 360a743a10392e0b82fd4acaae60e4114cfb7806 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 23 Jun 2016 18:47:31 +0200 Subject: bug #1241: does not emmit anything for empty tensors --- unsupported/Eigen/CXX11/src/Tensor/TensorIO.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorIO.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h index 58ffaefab..f3a3a1b88 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h @@ -26,10 +26,7 @@ struct TensorPrinter { typedef typename internal::remove_const::type Scalar; typedef typename Tensor::Index Index; const Index total_size = internal::array_prod(tensor.dimensions()); - if (total_size == 0) { - os << "Empty tensor of rank " << Rank; - } - else { + if (total_size > 0) { const Index first_dim = Eigen::internal::array_get<0>(tensor.dimensions()); static const int layout = Tensor::Layout; Map > matrix(const_cast(tensor.data()), first_dim, total_size/first_dim); @@ -46,10 +43,7 @@ struct TensorPrinter { typedef typename internal::remove_const::type Scalar; typedef typename Tensor::Index Index; const Index total_size = internal::array_prod(tensor.dimensions()); - if (total_size == 0) { - os << "Empty tensor of rank 1"; - } - else { + if (total_size > 0) { Map > array(const_cast(tensor.data()), total_size); os << array; } -- cgit v1.2.3