Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

fixed seed for mkldnn test #17386

Merged
merged 2 commits into from
Jan 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/python/mkl/test_mkldnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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():
Expand All @@ -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()
Expand Down