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 2019/10/28 11:49:02 UTC
[GitHub] [incubator-mxnet] xidulu edited a comment on issue #16646:
[Bug][Numpy] zeros_like, ones_like does not respect dtype flag
xidulu edited a comment on issue #16646: [Bug][Numpy] zeros_like, ones_like does not respect dtype flag
URL: https://github.com/apache/incubator-mxnet/issues/16646#issuecomment-546910645
I take a brief look at the `infertype` function for `zeros_like`:
https://github.com/apache/incubator-mxnet/blob/master/src/operator/numpy/np_init_op.cc#L103
The parameter `dtype` seems to be ignored.
The following experiment verified my conjecture:
```
In [1]: from mxnet import np
In [2]: a = np.ones(10)
In [3]: b = np.zeros_like(a, dtype="Life is short, use Pytorch")
In [4]: b
Out[4]: array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
In [5]: b.dtype
Out[5]: dtype('float32')
```
----------------------------------------------------------------
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