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/07/10 04:06:02 UTC

[GitHub] [incubator-mxnet] leezu opened a new issue #18685: mx.symbol.numpy._Symbol.__deepcopy__ logic error

leezu opened a new issue #18685:
URL: https://github.com/apache/incubator-mxnet/issues/18685


   `mx.symbol.numpy._Symbol.__deepcopy__` performs shallow copy instead of deep copy like `mx.symbol.Symbol.__deepcopy__ `.
   
   Problem:
   ```
   [ins] In [1]: import mxnet as mx
   
   [ins] In [2]: import copy
   
   [ins] In [3]: v = mx.sym.Variable('a').as_np_ndarray()
   
   [ins] In [4]: b = copy.copy(v)
   
   [ins] In [5]: b._set_attr(name='b')
   
   [ins] In [6]: v
   Out[6]: <_Symbol b>
   
   [ins] In [7]: b
   Out[7]: <_Symbol b>
   ```
   
   
   Expected:
   ```
   [ins] In [1]: import mxnet as mx
   
   [ins] In [2]: import copy
   
   [ins] In [3]: v = mx.sym.Variable('a').as_np_ndarray()
   
   [ins] In [4]: b = copy.copy(v)
   
   [ins] In [5]: b._set_attr(name='b')
   
   [ins] In [6]: v
   Out[6]: <_Symbol a>
   
   [ins] In [7]: b
   Out[7]: <_Symbol b>
   ```
   


----------------------------------------------------------------
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] wkcn commented on issue #18685: mx.symbol.numpy._Symbol.__deepcopy__ logic error

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


   Agree the expected result, which is consistent with `mx.nd`:
   ```python
   import mxnet as mx
   import copy
   
   v = mx.nd.array([1,2,3]).as_np_ndarray()
   b = copy.copy(v)
   b[0] = 10
   print(b) # [10. 2. 3.]
   print(v) # [1. 2. 3.]
   ```


----------------------------------------------------------------
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] szha closed issue #18685: mx.symbol.numpy._Symbol.__deepcopy__ logic error

Posted by GitBox <gi...@apache.org>.
szha closed issue #18685:
URL: https://github.com/apache/incubator-mxnet/issues/18685


   


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