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; }