mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-06 14:14:46 +08:00
Fix out-of bounds access in TensorArgMax.h.
This commit is contained in:
parent
1a737e1d6a
commit
d16634c4d4
@ -235,7 +235,6 @@ struct TensorEvaluator<const TensorTupleReducerOp<ReduceOp, Dims, ArgType>, Devi
|
|||||||
,m_device(device)
|
,m_device(device)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
gen_strides(m_orig_impl.dimensions(), m_strides);
|
gen_strides(m_orig_impl.dimensions(), m_strides);
|
||||||
if (Layout == static_cast<int>(ColMajor)) {
|
if (Layout == static_cast<int>(ColMajor)) {
|
||||||
const Index total_size = internal::array_prod(m_orig_impl.dimensions());
|
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());
|
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_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 {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user