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

Add test to check that binded is not set when exception thrown #12167

Merged
merged 5 commits into from
Aug 17, 2018
Merged
Changes from 3 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
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