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 2018/04/06 01:34:20 UTC
[GitHub] anirudh2290 opened a new issue #10431: Elementwise multiplication of two ndarrays returns wrong results
anirudh2290 opened a new issue #10431: Elementwise multiplication of two ndarrays returns wrong results
URL: https://github.com/apache/incubator-mxnet/issues/10431
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
Elementwise multiplication of two ndarrays returns wrong results
## Environment info (Required)
python, built from source, USE_CUDA=OFF, USE_CUDNN=OFF
MXNet commit hash:
(Paste the output of `git rev-parse HEAD` here.)
f60094053e5f2c233bb39b63bdd16503875a4551
## Error Message:
```
AssertionError:
Items are not equal:
Error 100000.000000 exceeds tolerance rtol=0.000010, atol=0.000000. Location of maximum error:(0, 2), a=0.098160, b=-375054495907840.000000
a: array([[ 0.88395894, 0.0185979 , 0.09815959, 0.24501987]], dtype=float32)
b: array([[ 8.83958936e-01, 1.85978990e-02, -3.75054496e+14,
2.45019868e-01]], dtype=float32)
```
## Minimum reproducible example
export MXNET_ENGINE_TYPE=NaiveEngine
```
import mxnet as mx
from mxnet.test_utils import *
x = mx.nd.array(np.random.uniform(-1, 1, size=(1, 4)))
x = x.tostype('csr')
#x.attach_grad()
print(x.asnumpy())
z2 = x * x
z1 = mx.nd.sparse.square(x)
assert_almost_equal(z1.asnumpy(), z2.asnumpy())
```
## What have you tried to solve it?
Substituting with mx.nd.square works fine
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services