Skip to content

Commit

Permalink
Merge pull request huggingface#20 from danblae/master
Browse files Browse the repository at this point in the history
iter.next() to next(iter)
  • Loading branch information
patrickloeber authored Jan 5, 2023
2 parents 63585a0 + 28e0e44 commit fbb6f59
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions 09_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __len__(self):

# convert to an iterator and look at one random sample
dataiter = iter(train_loader)
data = dataiter.next()
data = next(dataiter)
features, labels = data
print(features, labels)

Expand Down Expand Up @@ -97,6 +97,6 @@ def __len__(self):

# look at one random sample
dataiter = iter(train_loader)
data = dataiter.next()
data = next(dataiter)
inputs, targets = data
print(inputs.shape, targets.shape)
2 changes: 1 addition & 1 deletion 13_feedforward.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
shuffle=False)

examples = iter(test_loader)
example_data, example_targets = examples.next()
example_data, example_targets = next(examples)

for i in range(6):
plt.subplot(2,3,i+1)
Expand Down
2 changes: 1 addition & 1 deletion 14_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def imshow(img):

# get some random training images
dataiter = iter(train_loader)
images, labels = dataiter.next()
images, labels = next(dataiter)

# show images
imshow(torchvision.utils.make_grid(images))
Expand Down
2 changes: 1 addition & 1 deletion 16_tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
shuffle=False)

examples = iter(test_loader)
example_data, example_targets = examples.next()
example_data, example_targets = next(examples)

for i in range(6):
plt.subplot(2,3,i+1)
Expand Down

0 comments on commit fbb6f59

Please sign in to comment.