Skip to content

Commit e1ec4bd

Browse files
authored
Optimize DataLoader iteration in WrappedDataLoader (#2375)
1 parent e2a7ab0 commit e1ec4bd

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
@@ -795,8 +795,7 @@ def __len__(self):
795795
return len(self.dl)
796796

797797
def __iter__(self):
798-
batches = iter(self.dl)
799-
for b in batches:
798+
for b in self.dl:
800799
yield (self.func(*b))
801800

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

0 commit comments

Comments
 (0)