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/01/29 20:03:55 UTC

[GitHub] [incubator-mxnet] gautham-kollu opened a new issue #17471: Gluon Reshape behaves differently for NDArray and Symbol

gautham-kollu opened a new issue #17471: Gluon Reshape behaves differently for NDArray and Symbol
URL: https://github.com/apache/incubator-mxnet/issues/17471
 
 
   ## Description
   Gluon Reshape() behaves differently for NDArray and Symbol.
   NDArray -> Does the reshape IN-place
   Symbol -> Does the reshape Out-of-place
   
   ### Error Message
   (Paste the complete error message. Please also include stack trace by setting environment variable `DMLC_LOG_STACK_TRACE_DEPTH=10` before running your script.)
   
   ## To Reproduce
   import mxnet  as mx
   from mxnet.gluon import nn
   
   class HybridNet(nn.HybridBlock):
       def __init__(self, **kwargs):
           super(HybridNet, self).__init__(**kwargs)
   
       def hybrid_forward(self, F, x):
           y = x.reshape(-1)
           y = F.square(y, out = y)
           return x+y
   
   
   model = HybridNet()
   model.initialize()
   
   x = mx.nd.array([1,2,3])
   print(model(x))
   
   model.hybridize()
   x = mx.nd.array([1,2,3])
   print(model(x))
   
   ## Running the above on CPU
   [ 2.  8. 18.]
   <NDArray 3 @cpu(0)>
   
   [ 2.  6. 12.]
   <NDArray 3 @cpu(0)>
   
   ### Steps to reproduce
   (Paste the commands you ran that produced the error.)
   
   1.
   2.
   
   ## What have you tried to solve it?
   
   1.
   2.
   
   ## Environment
   
   We recommend using our script for collecting the diagnositc information. Run the following command and paste the outputs below:
   ```
   curl --retry 10 -s https://raw.githubusercontent.com/dmlc/gluon-nlp/master/tools/diagnose.py | python
   
   # paste outputs here
   ```
   

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

[GitHub] [incubator-mxnet] szha commented on issue #17471: Gluon Reshape does in-place for NDArray and out-of-place for Symbol

Posted by GitBox <gi...@apache.org>.
szha commented on issue #17471: Gluon Reshape does in-place for NDArray and out-of-place for Symbol
URL: https://github.com/apache/incubator-mxnet/issues/17471#issuecomment-580227599
 
 
   In Gluon one should not specify where the output is stored using `out=` argument. In the future, Gluon should automatically detect and warn (or throw execption) on such case.
   
   cc @leezu

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

[GitHub] [incubator-mxnet] gautham-kollu commented on issue #17471: Gluon Reshape does in-place for NDArray and out-of-place for Symbol

Posted by GitBox <gi...@apache.org>.
gautham-kollu commented on issue #17471: Gluon Reshape does in-place for NDArray and out-of-place for Symbol
URL: https://github.com/apache/incubator-mxnet/issues/17471#issuecomment-580381382
 
 
   Would Gluon not support in-place ops ?

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

[GitHub] [incubator-mxnet] leezu commented on issue #17471: Gluon Reshape does in-place for NDArray and out-of-place for Symbol

Posted by GitBox <gi...@apache.org>.
leezu commented on issue #17471: Gluon Reshape does in-place for NDArray and out-of-place for Symbol
URL: https://github.com/apache/incubator-mxnet/issues/17471#issuecomment-580564048
 
 
   Not when hybridizing. Ideally the framework can optimize the computational plan in the background and decide when in-place can be used.

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