Unverified Commit e65a857b authored by Hu Ye's avatar Hu Ye Committed by GitHub
Browse files

only set random generator if shuffle=true (#5135)


Co-authored-by: default avatarVasilis Vryniotis <datumbox@users.noreply.github.com>
parent 1abb56a3
......@@ -36,10 +36,10 @@ class RASampler(torch.utils.data.Sampler):
self.repetitions = repetitions
def __iter__(self):
# Deterministically shuffle based on epoch
g = torch.Generator()
g.manual_seed(self.seed + self.epoch)
if self.shuffle:
# Deterministically shuffle based on epoch
g = torch.Generator()
g.manual_seed(self.seed + self.epoch)
indices = torch.randperm(len(self.dataset), generator=g).tolist()
else:
indices = list(range(len(self.dataset)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment