Skip to content
Merged
Changes from 2 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
9 changes: 8 additions & 1 deletion src/lightning/pytorch/utilities/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,14 @@ def _is_dataloader_shuffled(dataloader: object) -> bool:
if not hasattr(dataloader, "sampler"):
# shuffling is enabled via a sampler. No sampler, no shuffling
return False
sampler = dataloader.sampler

batch_sampler = dataloader.batch_sampler
if batch_sampler is not None:
# batchsize == 1 case:
sampler = batch_sampler.sampler
else:
sampler = dataloader.sampler

if isinstance(sampler, SequentialSampler):
return False
return isinstance(sampler, RandomSampler)
Loading