Skip to content

Commit

Permalink
Add test to check that binded is not set when exception thrown (apach…
Browse files Browse the repository at this point in the history
…e#12167)

* add test to check binded is not when exception thrown

* add error to assertion

* fix typo by adding asserts

* retrigger
  • Loading branch information
azai91 authored and anirudh2290 committed Aug 17, 2018
1 parent cd9f9c8 commit f737cac
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/python/unittest/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ def test_module_dtype():
assert x.dtype == dtype


def test_module_bind():
sym = mx.sym.Variable('data')
sym = mx.sym.Activation(data=sym, act_type='relu', __layout__='TNC')

mod = mx.mod.Module(sym, ('data',), None, context=[mx.cpu(0), mx.cpu(1)])
assertRaises(TypeError, mod.bind, data_shapes=[('data', mx.nd.array([10,10]))])
assert mod.binded == False

mod.bind(data_shapes=[('data', (10,10))])
assert mod.binded == True


@with_seed()
def test_module_input_grads():
a = mx.sym.Variable('a', __layout__='NC')
Expand Down

0 comments on commit f737cac

Please sign in to comment.