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 2020/04/20 20:20:02 UTC

[GitHub] [incubator-mxnet] sxjscience opened a new issue #18117: [Gluon][Numpy] Bug of save parameters with numpy front-end

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



[GitHub] [incubator-mxnet] leezu commented on issue #18117: [Gluon][Numpy] Bug of save parameters with numpy front-end

Posted by GitBox <gi...@apache.org>.
leezu commented on issue #18117:
URL: https://github.com/apache/incubator-mxnet/issues/18117#issuecomment-625502229


   @sxjscience being able to save a single parameter seems quite sensible. Why should we deprecate it? We may change the serialization format though


----------------------------------------------------------------
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



[GitHub] [incubator-mxnet] sxjscience commented on issue #18117: [Gluon][Numpy] Bug of save parameters with numpy front-end

Posted by GitBox <gi...@apache.org>.
sxjscience commented on issue #18117:
URL: https://github.com/apache/incubator-mxnet/issues/18117#issuecomment-625506608


   I think we should not deprecate it.
   
   Get Outlook for iOS<https://aka.ms/o0ukef>
   ________________________________
   From: Leonard Lausen <no...@github.com>
   Sent: Thursday, May 7, 2020 2:17:13 PM
   To: apache/incubator-mxnet <in...@noreply.github.com>
   Cc: Xingjian SHI <xs...@connect.ust.hk>; Mention <me...@noreply.github.com>
   Subject: Re: [apache/incubator-mxnet] [Gluon][Numpy] Bug of save parameters with numpy front-end (#18117)
   
   
   @sxjscience<https://github.com/sxjscience> being able to save a single parameter seems quite sensible. Why should we deprecate it? We may change the serialization format though
   
   —
   You are receiving this because you were mentioned.
   Reply to this email directly, view it on GitHub<https://github.com/apache/incubator-mxnet/issues/18117#issuecomment-625502229>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHQH3UMTVME7CLE3JX6V4LRQMQNTANCNFSM4MMXWFKQ>.
   


----------------------------------------------------------------
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



[GitHub] [incubator-mxnet] leezu commented on issue #18117: [Gluon][Numpy] Bug of save parameters with numpy front-end

Posted by GitBox <gi...@apache.org>.
leezu commented on issue #18117:
URL: https://github.com/apache/incubator-mxnet/issues/18117#issuecomment-626066067


   Going forward we can simply use the npy / npz formats https://numpy.org/devdocs/reference/generated/numpy.lib.format.html 


----------------------------------------------------------------
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



[GitHub] [incubator-mxnet] yzhliu commented on issue #18117: [Gluon][Numpy] Bug of save parameters with numpy front-end

Posted by GitBox <gi...@apache.org>.
yzhliu commented on issue #18117:
URL: https://github.com/apache/incubator-mxnet/issues/18117#issuecomment-621630637


   @Tommliu is working on this.


----------------------------------------------------------------
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