def test_exc_gluon(): def gluon(exec_wait=True): model = nn.Sequential() model.add(nn.Dense(128, activation='tanh', in_units=10, flatten=False)) model.add(nn.Dropout(1)) model.add(nn.Dense(64, activation='tanh', in_units=256), nn.Dense(32, in_units=64)) x = mx.sym.var('data') y = model(x) model.collect_params().initialize(ctx=[default_context()]) z = model(mx.nd.random.normal(10, -10, (32, 2, 10), ctx=default_context())) if exec_wait: z.wait_to_read() gluon(exec_wait=False) assert_raises(MXNetError, gluon, True)
def test_exc_gluon(): def gluon(exec_wait=True): model = nn.Sequential() model.add(nn.Dense(128, activation='tanh', in_units=10, flatten=False)) model.add(nn.Dropout(1)) model.add(nn.Dense(64, activation='tanh', in_units=256), nn.Dense(32, in_units=64)) x = mx.sym.var('data') y = model(x) model.collect_params().initialize(ctx=[default_context()]) z = model( mx.nd.random.normal(10, -10, (32, 2, 10), ctx=default_context())) if exec_wait: z.wait_to_read() gluon(exec_wait=False) assert_raises(MXNetError, gluon, True)