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

[BUGFIX] fix unknown parameter shapes when np_shape is turned on. #15097

Merged
merged 9 commits into from
Jun 2, 2019
Merged
Changes from 1 commit
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
Next Next commit
add test.
  • Loading branch information
Ubuntu authored and zheng-da committed May 30, 2019
commit a5b9104da44a1505e3e17625dc0d97c28957d0c5
17 changes: 17 additions & 0 deletions tests/python/unittest/test_gluon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,23 @@ def hybrid_forward(self, F, x):
net = Net(act0, act1, shape, slice)
check_layer_forward_withinput(net, x)

@with_seed()
def test_np_shape_parameters():
class Foo(gluon.Block):
def __init__(self, **kwargs):
super(Foo, self).__init__(**kwargs)
self.dense = gluon.nn.Dense(16)
def forward(self, x):
return self.dense(x)

mx.set_np_compat(True)
z = mx.nd.zeros((2,2016))
print(z.shape)
foo = Foo()
foo.initialize()
print(foo(z).shape)
mx.set_np_compat(False)

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