I changed the parameter ‘num_workers’ of dataloader. Then I found some interesting thing. _SingleProcessDataLoaderIter doesn’t hava this problem. _MultiProcessingDataLoaderIter takes a long time when the StopIteration exception occurs.