Commit f135cecc authored by Mark Ryan's avatar Mark Ryan
Browse files

Fix nn_test.py on AVX512 builds



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: default avatarMark Ryan <mark.d.ryan@intel.com>
parent a769c3ac
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment