sxjscience opened a new issue #18117:
URL: https://github.com/apache/incubator-mxnet/issues/18117
Reproducible example:
```python
import mxnet as mx
from mxnet.gluon import HybridBlock, nn
import os
mx.npx.set_np()
class Foo(HybridBlock):
def __init__(self, prefix=None, params=None):
super().__init__(prefix=prefix, params=params)
with self.name_scope():
self.l1 = nn.Dense(2048, prefix='layer_')
def hybrid_forward(self, F, x):
return self.l1(x)
foo = Foo()
foo.initialize()
foo(mx.np.ones((32, 2048)))
foo.collect_params().save('test.params')
```
Error:
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-d2952519ca80> in <module>
17 foo.initialize()
18 foo(mx.np.ones((32, 2048)))
---> 19 foo.collect_params().save('test.params')
20
~/mxnet/python/mxnet/gluon/parameter.py in save(self, filename, strip_prefix)
984 strip_prefix, param.name, strip_prefix))
985 arg_dict[param.name[len(strip_prefix):]] = weight
--> 986 ndarray.save(filename, arg_dict)
987
988 def load(self, filename, ctx=None, allow_missing=False,
~/mxnet/python/mxnet/ndarray/utils.py in save(fname, data)
260 raise TypeError('save only accept dict str->NDArray or
list of NDArray')
261 if any(isinstance(v, np_ndarray) for v in nd_vals):
--> 262 raise TypeError('cannot save mxnet.numpy.ndarray using
mxnet.ndarray.save;'
263 ' use mxnet.numpy.save instead.')
264 keys = c_str_array(str_keys)
TypeError: cannot save mxnet.numpy.ndarray using mxnet.ndarray.save; use
mxnet.numpy.save instead.
```
----------------------------------------------------------------
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:
[email protected]