mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix TensorReduction warnings and error bound for sum accuracy test.
The sum accuracy test currently uses the default test precision for the given scalar type. However, scalars are generated via a normal distribution, and given a large enough count and strong enough random generator, the expected sum is zero. This causes the test to periodically fail. Here we estimate an upper-bound for the error as `sqrt(N) * prec` for summing N values, with each having an approximate epsilon of `prec`. Also fixed a few warnings generated by MSVC when compiling the reduction test.
This commit is contained in:
committed by
Antonio Sanchez
parent
b3bea43a2d
commit
f6c8cc0e99
@@ -633,7 +633,7 @@ static const bool RunningOnGPU = false;
|
||||
m_fastOutputStrides[i] = internal::TensorIntDivisor<Index>(m_outputStrides[i]);
|
||||
}
|
||||
} else {
|
||||
m_outputStrides[NumOutputDims - 1] = 1;
|
||||
m_outputStrides[static_cast<size_t>(NumOutputDims - 1)] = 1;
|
||||
for (int i = NumOutputDims - 2; i >= 0; --i) {
|
||||
m_outputStrides[i] = m_outputStrides[i + 1] * m_dimensions[i + 1];
|
||||
m_fastOutputStrides[i] = internal::TensorIntDivisor<Index>(m_outputStrides[i]);
|
||||
@@ -680,7 +680,7 @@ static const bool RunningOnGPU = false;
|
||||
? internal::array_prod(input_dims)
|
||||
: (static_cast<int>(Layout) == static_cast<int>(ColMajor))
|
||||
? m_preservedStrides[0]
|
||||
: m_preservedStrides[NumOutputDims - 1];
|
||||
: m_preservedStrides[static_cast<size_t>(NumOutputDims - 1)];
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
|
||||
|
||||
Reference in New Issue
Block a user