Neutron3529 commented on pull request #19738:
URL: https://github.com/apache/incubator-mxnet/pull/19738#issuecomment-757473252


   > You can also force the prefetching by calling `iter(dataloader)` 
immediately after the dataloader is created.
   
   It is not easy remember to call `iter(dataloader)` immediately after the 
dataloader is empty.
   as for change the state of dataset, AFAIK, a dataset with index is all users 
need:
   ```python
   class C100Idx(mx.gluon.data.vision.CIFAR100):
       def __getitem__(self,idx):
           return self._data[idx], self._label[idx],idx
   class C10Idx(mx.gluon.data.vision.CIFAR10):
       def __getitem__(self,idx):
           return self._data[idx], self._label[idx],idx
   ...
   ```
   
   Anyway, I modified the old code, add a new parameter called 
`prefetch_next_epoch`(default to `True`)
   and add 2 function to switch the prefetch state (one switch to prefetch and 
one disable it.)


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


Reply via email to