safrooze commented on issue #9026: why is it so slow (MXNET0.12)even with 
NVIDIA V100 GPU?
URL: 
https://github.com/apache/incubator-mxnet/issues/9026#issuecomment-406070421
 
 
   @dbsxdbsx It's quite easy to use DataLoader with a custom DataSet object. 
Your custom DataSet class needs to implement only two functions: `__len__()` 
and `__getitem_()`. You can then easily use DataLoader with num_workers>1. Here 
is a dummy example of a custom dataset class that contains 1000 elements, each 
one the index plus some random noise:
   
   ```
   class MyRandomDataset(object):
       def __getitem__(self, idx):
           return nd.array([idx]) + nd.random.normal()
   
       def __len__(self):
           return 1000
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to