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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to