ZiyueHuang commented on a change in pull request #8550: csr ndarray iter with shuffle URL: https://github.com/apache/incubator-mxnet/pull/8550#discussion_r149058565
########## File path: python/mxnet/io.py ########## @@ -630,22 +631,25 @@ def __init__(self, data, label=None, batch_size=1, shuffle=False, super(NDArrayIter, self).__init__(batch_size) if ((_has_instance(data, CSRNDArray) or _has_instance(label, CSRNDArray)) and - (shuffle or last_batch_handle != 'discard')): + (last_batch_handle != 'discard')): raise NotImplementedError("`NDArrayIter` only supports ``CSRNDArray``" \ - " with `shuffle` set to `False`" \ - " and `last_batch_handle` set to `discard`.") + " with `last_batch_handle` set to `discard`.") self.data = _init_data(data, allow_empty=False, default_name=data_name) self.label = _init_data(label, allow_empty=True, default_name=label_name) self.idx = np.arange(self.data[0][1].shape[0]) # shuffle data if shuffle: np.random.shuffle(self.idx) - self.data = [(k, array(v.asnumpy()[self.idx], v.context)) + self.data = [(k, sparse_array(v.asscipy()[self.idx], v.context) Review comment: Done :) ---------------------------------------------------------------- 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