Skip to content

Commit 0dcab04

Browse files
ved1betaBorda
andauthored
Update src/lightning/pytorch/trainer/connectors/data_connector.py
Co-authored-by: Jirka Borovec <[email protected]>
1 parent 1f5ece2 commit 0dcab04

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/lightning/pytorch/trainer/connectors/data_connector.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def __len__(self):
285285
sampler = SequentialSampler(dl.dataset)
286286

287287
# Create a new dataloader with the new sampler
288-
new_dl = DataLoader(
288+
dl = DataLoader(
289289
dataset=dl.dataset,
290290
batch_size=dl.batch_size,
291291
sampler=sampler,
@@ -300,9 +300,7 @@ def __len__(self):
300300
prefetch_factor=dl.prefetch_factor,
301301
persistent_workers=dl.persistent_workers,
302302
)
303-
updated.append(new_dl)
304-
else:
305-
updated.append(dl)
303+
updated.append(dl)
306304

307305
combined_loader.flattened = updated
308306

0 commit comments

Comments
 (0)