Skip to content

Commit 7ecf315

Browse files
committed
Fix issue #7209 in DataLoader
1 parent 92f54e1 commit 7ecf315

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torch/utils/data/dataloader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ def __init__(self, loader):
246246

247247
self.sample_iter = iter(self.batch_sampler)
248248

249+
base_seed = torch.LongTensor(1).random_()[0]
250+
249251
if self.num_workers > 0:
250252
self.worker_init_fn = loader.worker_init_fn
251253
self.index_queues = [multiprocessing.Queue() for _ in range(self.num_workers)]
@@ -258,7 +260,6 @@ def __init__(self, loader):
258260
self.rcvd_idx = 0
259261
self.reorder_dict = {}
260262

261-
base_seed = torch.LongTensor(1).random_()[0]
262263
self.workers = [
263264
multiprocessing.Process(
264265
target=_worker_loop,

0 commit comments

Comments
 (0)