aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2019-03-11 09:42:01 -0700
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2019-03-11 09:42:01 -0700
commit899c16fa2cec396a7d75dff020f6f755834f5961 (patch)
tree6dc6a53ec6a02277cc5f10e726634f2f1f7c50f7 /unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h
parent0f8bfff23df9375080fb08de947c623f652fe27b (diff)
Fix a bug in TensorGenerator for 1d tensors
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h3
1 files changed, 3 insertions, 0 deletions
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<const TensorGeneratorOp<Generator, ArgType>, 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) {