Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch modifies the nn_test test case L2LossTest.testGradient
so that it passes on AVX512 builds. The test case is failing
as the error tolerance used in the test case is too strict.
The test case compares the difference of pairs of tensor reductions
to an expected result. If the comparison is out by more than 1e-11
the test case fails. The problem here is that the results of a
summation reduction of doubles of the same tensor can differ slightly
on different builds. AVX2, AVX512 and non vectorized versions of the
tensor contraction algorithm add the tensor's contents together in
different orders and this different ordering can produce slightly
different results due to rounding errors.
The accuracy of AVX512 tensor reduction is no worse than the AVX2
implementation. In fact, it's only luck that this test case passes
on AVX2 builds and fails on AVX512 builds. If the seed at the start of
the test is changed from 1 to 3, the test passes on AVX512 builds and
fails on AVX2 builds. Rather than trying to find a seed that allows
the test case to pass on all CPU architectures, it is better to relax
the test criteria a little bit.
Signed-off-by: Mark Ryan mark.d.ryan@intel.com