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 2017/10/25 23:05:42 UTC
[GitHub] anirudh2290 opened a new issue #8430: NDArrayIter doesn't preserve dtype of labels
anirudh2290 opened a new issue #8430: NDArrayIter doesn't preserve dtype of labels
URL: https://github.com/apache/incubator-mxnet/issues/8430
## Description
when passing numpy arrays the dtype of the numpy arrays is not used to construct mxnet ndarrays.
Please see https://discuss.mxnet.io/t/integer-labels-in-ndarrayiter/169
## Environment info (Required)
Deep Learning AMI, mxnet master, HEAD: f9e25b47c0faec07e940fedb718df2f38dd925b4
Package used (Python/R/Scala/Julia): Python
MXNet commit hash: f9e25b47c0faec07e940fedb718df2f38dd925b4
## Error Message: No error but the dtype of Y_train is not used
## Steps to reproduce
Run the following:
```
import mxnet as mx
import numpy as np
X_train = np.array([1,2,3,4,5])
Y_train = np.array([1,2,3,4,5111111122], dtype='int64')
train_data = mx.io.NDArrayIter(X_train, Y_train, 2, shuffle=False)
print train_data.label[0]
```
## What have you tried to solve it?
The issue is that the dtype of numpy is not passed when calling the array util (https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/io.py#L509)
The workaround can be to just use nd arrays for Y_train instead of numpy ndarray. It fixes the issue but with shuffle=True this again breaks. (https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/io.py#L634)
Is there any specific reason to not pass the dtype of numpy or ndarrays to array util ?
----------------------------------------------------------------
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