diff options
author | 2019-03-04 16:58:49 -0800 | |
---|---|---|
committer | 2019-03-04 16:58:49 -0800 | |
commit | efb5080d313a38cd204942237689de0bda412732 (patch) | |
tree | a3a042d618a4bab8849c512d9b762c08dedf2229 /unsupported/Eigen | |
parent | b95941e5c2cf8886a54e510be662cf4ecadc4f6f (diff) |
Do not initialize invalid fast_strides in TensorGeneratorOp
Diffstat (limited to 'unsupported/Eigen')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h b/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h index 0fee18fb6..cf1e821a9 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h @@ -113,16 +113,15 @@ struct TensorEvaluator<const TensorGeneratorOp<Generator, ArgType>, Device> m_strides[0] = 1; for (int i = 1; i < NumDims; ++i) { m_strides[i] = m_strides[i - 1] * m_dimensions[i - 1]; + if (m_strides[i] != 0) m_fast_strides[i] = IndexDivisor(m_strides[i]); } } else { m_strides[NumDims - 1] = 1; for (int i = NumDims - 2; i >= 0; --i) { m_strides[i] = m_strides[i + 1] * m_dimensions[i + 1]; + if (m_strides[i] != 0) m_fast_strides[i] = IndexDivisor(m_strides[i]); } } - for (int i = 0; i < NumDims; ++i) { - m_fast_strides[i] = IndexDivisor(m_strides[i]); - } } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; } |