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

[v1.x] Add with_seed to test_take_grads #20191

Merged
merged 1 commit into from
Apr 20, 2021
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
11 changes: 6 additions & 5 deletions tests/python/unittest/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10041,10 +10041,7 @@ def test_scalarop_locale_invariance():
finally:
locale.setlocale(locale.LC_NUMERIC, prev)

if __name__ == '__main__':
import nose
nose.runmodule()

@with_seed()
def test_take_grads():
# Test for https://github.com/apache/incubator-mxnet/issues/19817
from mxnet.gluon.nn import HybridBlock, Conv1D, HybridSequential, HybridLambda, Dense
Expand Down Expand Up @@ -10133,4 +10130,8 @@ def hybrid_forward(self, F, X, axis=-1):
grads2 = run_model(model2, loss, X, Y)

for i in range(len(grads1)):
assert_almost_equal(grads1[i], grads2[i])
assert_almost_equal(grads1[i], grads2[i])

if __name__ == '__main__':
import nose
nose.runmodule()