From 8800ec56fcd810b158b4efdba13088f41cbfee28 Mon Sep 17 00:00:00 2001 From: "G.Hemanth Sai" <73033596+HemanthSai7@users.noreply.github.com> Date: Thu, 1 Jun 2023 08:59:12 +0530 Subject: [PATCH] Optimize DataLoader iteration in WrappedDataLoader --- beginner_source/nn_tutorial.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/beginner_source/nn_tutorial.py b/beginner_source/nn_tutorial.py index bc32131b93a..7b39d6f754c 100644 --- a/beginner_source/nn_tutorial.py +++ b/beginner_source/nn_tutorial.py @@ -790,8 +790,7 @@ def __len__(self): return len(self.dl) def __iter__(self): - batches = iter(self.dl) - for b in batches: + for b in self.dl: yield (self.func(*b)) train_dl, valid_dl = get_data(train_ds, valid_ds, bs)