From cba4a53dc9c3ad5877c33130c6cc0ccc2b3af900 Mon Sep 17 00:00:00 2001 From: heaseny <35910818+heaseny@users.noreply.github.com> Date: Sat, 25 Jan 2020 16:31:11 +0800 Subject: [PATCH] fixed seed for mkldnn test (#17386) * fix seed for mkldnn test * use fixed seed for mkldnn test --- tests/python/mkl/test_mkldnn.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/python/mkl/test_mkldnn.py b/tests/python/mkl/test_mkldnn.py index 869ee6cf216c..a146a0071cb6 100644 --- a/tests/python/mkl/test_mkldnn.py +++ b/tests/python/mkl/test_mkldnn.py @@ -61,6 +61,7 @@ def get_tensors(args, shapes, ctx): except: # pylint: disable=bare-except assert 0, "test_mkldnn_model exception in bind and execution" +@with_seed(1234) def test_mkldnn_ndarray_slice(): ctx = mx.cpu() net = gluon.nn.HybridSequential() @@ -71,8 +72,9 @@ def test_mkldnn_ndarray_slice(): y = net(x) # trigger computation on ndarray slice - assert_almost_equal(y[0].asnumpy()[0, 0, 0], np.array(0.3376348)) + assert_almost_equal(y[0].asnumpy()[0, 0, 0], np.array(0.056331709)) +@with_seed(1234) def test_mkldnn_engine_threading(): net = gluon.nn.HybridSequential() with net.name_scope(): @@ -94,8 +96,8 @@ def __getitem__(self, key): # below line triggers different execution thread for _ in loader: y = net(mx.nd.array(np.ones(X))).asnumpy() - # output should be 016711406 (non-mkldnn mode output) - assert_almost_equal(y[0, 0, 0, 0], np.array(0.016711406)) + # output should be 056331709 (non-mkldnn mode output) + assert_almost_equal(y[0, 0, 0, 0], np.array(0.056331709)) break @with_seed()