return next(self._sampler_iter) # may raise StopIteration
return next(self._sampler_iter) # may raise StopIteration Question: Instead of using enumerate(data loader) for some reason, I am creating iterator for the data loader. In the while loop shown below, it gives me StopIteration error. Minimalistic code that depicts the cause: loader = DataLoader(dataset, batch_size=args.batch_size) dataloader_iter = iter(loader) while(dataloader_iter): X, y = next(dataloader_iter) … What would …