eric-haibin-lin opened a new issue #8660: Incorrect autograd results for 
elemwise_add 
URL: https://github.com/apache/incubator-mxnet/issues/8660
 
 
   Note: Providing complete information in the most concise form is the best 
way to get help. This issue template serves as the checklist for essential 
information to most of the technical issues and bug reports. For non-technical 
issues and feature requests, feel free to present the information in what you 
believe is the best form.
   
   For Q & A and discussion, please start a discussion thread at 
https://discuss.mxnet.io 
   
   ## Description
   The gradients for `elemwise_add` seem to be incorrect when used with 
autograd. See the script at the bottom for details. @ptrendx do you have any 
insight for this? 
   
   ## Environment info (Required)
   
   ```
   What to do:
   1. Download the diagnosis script from 
https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
   2. Run the script using `python diagnose.py` and paste its output here.
   
   ```
   
   Package used (Python/R/Scala/Julia):
   (I'm using ...)
   
   For Scala user, please provide:
   1. Java version: (`java -version`)
   2. Maven version: (`mvn -version`)
   3. Scala runtime if applicable: (`scala -version`)
   
   For R user, please provide R `sessionInfo()`:
   
   ## Build info (Required if built from source)
   
   Compiler (gcc/clang/mingw/visual studio):
   
   MXNet commit hash: v0.12
   (Paste the output of `git rev-parse HEAD` here.)
   
   Build config:
   (Paste the content of config.mk, or the build command.)
   
   ## Error Message:
   (Paste the complete error message, including stack trace.)
   
   ## Minimum reproducible example
   (If you are using your own code, please provide a short script that 
reproduces the error. Otherwise, please provide link to the existing example.)
   ```
   >>> import mxnet as mx
   >>> a = mx.nd.random_normal(shape=(2,2))
   >>> b = mx.nd.random_normal(shape=(2,2))
   >>> a.attach_grad()
   >>> b.attach_grad()
   >>> with mx.autograd.record():
   ...     c = mx.nd.elemwise_add(a,b)
   ...
   >>> c.backward()
   >>> a.grad
   
   [[ 0.  0.]
    [ 0.  0.]]
   <NDArray 2x2 @cpu(0)>
   >>> b.grad
   
   [[ 0.  0.]
    [ 0.  0.]]
   <NDArray 2x2 @cpu(0)>
   >>> with mx.autograd.record():
   ...     c = mx.nd.broadcast_add(a,b)
   ...
   >>> c.backward()
   >>> a.grad
   
   [[ 1.  1.]
    [ 1.  1.]]
   <NDArray 2x2 @cpu(0)>
   >>> b.grad
   
   [[ 1.  1.]
    [ 1.  1.]]
   ```
   ## Steps to reproduce
   (Paste the commands you ran that produced the error.)
   
   1.
   2.
   
   ## What have you tried to solve it?
   
   1.
   2.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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