From 3332b24a84d929cf97127db0021f1c12a7ccb367 Mon Sep 17 00:00:00 2001 From: "Yang, XuecunX@intel.com" Date: Mon, 20 Jan 2020 16:45:54 +0800 Subject: [PATCH 1/2] fix seed for mkldnn test --- tests/python/mkl/test_mkldnn.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/python/mkl/test_mkldnn.py b/tests/python/mkl/test_mkldnn.py index 869ee6cf216c..af1404d77bcf 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(): @@ -95,7 +97,7 @@ def __getitem__(self, key): 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)) + assert_almost_equal(y[0, 0, 0, 0], np.array(0.056331709)) break @with_seed() From d6caf654ea19377d7dff6b8ee392f7dc47921cf8 Mon Sep 17 00:00:00 2001 From: "Yang, XuecunX@intel.com" Date: Mon, 20 Jan 2020 17:18:15 +0800 Subject: [PATCH 2/2] use fixed seed for mkldnn test --- tests/python/mkl/test_mkldnn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/python/mkl/test_mkldnn.py b/tests/python/mkl/test_mkldnn.py index af1404d77bcf..a146a0071cb6 100644 --- a/tests/python/mkl/test_mkldnn.py +++ b/tests/python/mkl/test_mkldnn.py @@ -96,7 +96,7 @@ 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) + # output should be 056331709 (non-mkldnn mode output) assert_almost_equal(y[0, 0, 0, 0], np.array(0.056331709)) break