Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions torch/utils/data/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ def __init__(self, dataset, batch_size=1, shuffle=False, sampler=None, batch_sam
if sampler is not None and shuffle:
raise ValueError('sampler is mutually exclusive with shuffle')

if self.num_workers < 0:
raise ValueError('num_workers cannot be negative; '
'use num_workers=0 to disable multiprocessing.')

if batch_sampler is None:
if sampler is None:
if shuffle:
Expand Down