Skip to content

Commit 8800ec5

Browse files
committed
Optimize DataLoader iteration in WrappedDataLoader
1 parent ddcc10c commit 8800ec5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Diff for: beginner_source/nn_tutorial.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,7 @@ def __len__(self):
790790
return len(self.dl)
791791

792792
def __iter__(self):
793-
batches = iter(self.dl)
794-
for b in batches:
793+
for b in self.dl:
795794
yield (self.func(*b))
796795

797796
train_dl, valid_dl = get_data(train_ds, valid_ds, bs)

0 commit comments

Comments
 (0)