You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/09/05 06:14:33 UTC
[GitHub] [incubator-mxnet] reminisce commented on issue #16098: [Bug]
Unrecognize parameter shape after npx.set_up()
reminisce commented on issue #16098: [Bug] Unrecognize parameter shape after npx.set_up()
URL: https://github.com/apache/incubator-mxnet/issues/16098#issuecomment-528214571
It looks like you saved a net which has not been initialized. It should work like the following. However, recent changes on ndarray indexing has prevented assigning a legacy `NDArray` to `mxnet.numpy.ndarray`. So the `load` function cannot work now. I will submit a PR to fix this.
```python
from mxnet import npx, np
npx.set_np()
from mxnet.gluon import nn
print(nn.Dense(32).collect_params()) # weight shape=(32,-1)
net = nn.Dense(32)
net.initialize()
net(np.ones((4, 11)))
print(net.collect_params()) # weight shape=(32,-1)
net.save_parameters('test.params')
net.load_parameters('test.params')
print(net.collect_params())
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services