We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93a8dda commit 1ac19eaCopy full SHA for 1ac19ea
torch/utils/data/dataloader.py
@@ -896,7 +896,10 @@ def _shutdown_workers(self):
896
897
# Exit workers now.
898
self.workers_done_event.set()
899
- for worker_id in range(self.num_workers):
+ for worker_id in range(len(self.workers)):
900
+ # Get number of workers from `len(self.workers)` instead of
901
+ # `self.num_workers` in case we error before starting all
902
+ # workers.
903
if self.workers_status[worker_id]:
904
self._shutdown_worker(worker_id)
905
for w in self.workers:
0 commit comments