From 899c16fa2cec396a7d75dff020f6f755834f5961 Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Mon, 11 Mar 2019 09:42:01 -0700 Subject: Fix a bug in TensorGenerator for 1d tensors --- unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h b/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h index 24a7dd0ca..204a6fd33 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h @@ -208,6 +208,9 @@ struct TensorEvaluator, Device> coords[is_col_major ? 0 : NumDims - 1] = initial_coords[is_col_major ? 0 : NumDims - 1]; + // For the 1d tensor we need to generate only one inner-most dimension. + if (NumDims == 1) break; + // Update offset. for (Index i = 1; i < NumDims; ++i) { if (++it[i].count < it[i].size) { -- cgit v1.2.3