diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2014-10-30 18:15:05 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2014-10-30 18:15:05 -0700 |
commit | d62bfe73a92878c878a6b46674a2ea4cec130ac8 (patch) | |
tree | ddb16de36c53210c954ac887e46c22f7cb0cedd6 /unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h | |
parent | bc99c5f7db8d4d7e41e5e4358170e99a1bf9d364 (diff) |
Use the proper index type in the padding code
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h index 89c0cff05..d6347b054 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h @@ -98,7 +98,6 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device for (int i = 0; i < NumDims; ++i) { m_dimensions[i] += m_padding[i].first + m_padding[i].second; } - const typename TensorEvaluator<ArgType, Device>::Dimensions& input_dims = m_impl.dimensions(); m_inputStrides[0] = 1; m_outputStrides[0] = 1; @@ -125,6 +124,7 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const { + eigen_assert(index < dimensions().TotalSize()); Index inputIndex = 0; for (int i = NumDims - 1; i > 0; --i) { const Index idx = index / m_outputStrides[i]; @@ -151,11 +151,11 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device const Index initialIndex = index; Index inputIndex = 0; for (int i = NumDims - 1; i > 0; --i) { - const int first = index; - const int last = index + packetSize - 1; - const int lastPaddedLeft = m_padding[i].first * m_outputStrides[i]; - const int firstPaddedRight = (m_dimensions[i] - m_padding[i].second) * m_outputStrides[i]; - const int lastPaddedRight = m_outputStrides[i+1]; + const Index first = index; + const Index last = index + packetSize - 1; + const Index lastPaddedLeft = m_padding[i].first * m_outputStrides[i]; + const Index firstPaddedRight = (m_dimensions[i] - m_padding[i].second) * m_outputStrides[i]; + const Index lastPaddedRight = m_outputStrides[i+1]; if (last < lastPaddedLeft) { // all the coefficient are in the padding zone. @@ -179,9 +179,9 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device const Index last = index + packetSize - 1; const Index first = index; - const int lastPaddedLeft = m_padding[0].first; - const int firstPaddedRight = (m_dimensions[0] - m_padding[0].second); - const int lastPaddedRight = m_outputStrides[1]; + const Index lastPaddedLeft = m_padding[0].first; + const Index firstPaddedRight = (m_dimensions[0] - m_padding[0].second); + const Index lastPaddedRight = m_outputStrides[1]; if (last < lastPaddedLeft) { // all the coefficient are in the padding zone. |