aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2018-10-08 16:41:36 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2018-10-08 16:41:36 -0700
commitd16634c4d47bf751ff55e884cd76f742a7fb8e17 (patch)
tree038d443f45403bda6b6496d53d5de6ed61b2ce0e /unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h
parent1a737e1d6aaca52055489d3d19c9aa469a5e2812 (diff)
Fix out-of bounds access in TensorArgMax.h.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h b/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h
index ea3ab329d..6f7c6d86d 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h
@@ -235,7 +235,6 @@ struct TensorEvaluator<const TensorTupleReducerOp<ReduceOp, Dims, ArgType>, Devi
,m_device(device)
#endif
{
-
gen_strides(m_orig_impl.dimensions(), m_strides);
if (Layout == static_cast<int>(ColMajor)) {
const Index total_size = internal::array_prod(m_orig_impl.dimensions());
@@ -244,7 +243,7 @@ struct TensorEvaluator<const TensorTupleReducerOp<ReduceOp, Dims, ArgType>, Devi
const Index total_size = internal::array_prod(m_orig_impl.dimensions());
m_stride_mod = (m_return_dim > 0) ? m_strides[m_return_dim - 1] : total_size;
}
- m_stride_div = m_strides[m_return_dim];
+ m_stride_div = (m_return_dim >= 0) ? m_strides[m_return_dim] : 1;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const {