Skip to content

Commit

Permalink
Update next(iter) to align with Python3 (#2087)
Browse files Browse the repository at this point in the history
* Update next(iter) to align with Python3
  • Loading branch information
Svetlana Karslioglu authored Oct 18, 2022
1 parent 998c026 commit 7d8cb43
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions beginner_source/introyt/introyt1_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def imshow(img):

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

# show images
imshow(torchvision.utils.make_grid(images))
Expand Down Expand Up @@ -446,7 +446,7 @@ def imshow(img):

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

# show images
imshow(torchvision.utils.make_grid(images))
Expand Down
4 changes: 2 additions & 2 deletions beginner_source/introyt/tensorboardyt_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def matplotlib_imshow(img, one_channel=False):

# Extract a batch of 4 images
dataiter = iter(training_loader)
images, labels = dataiter.next()
images, labels = next(dataiter)

# Create a grid from the images and show them
img_grid = torchvision.utils.make_grid(images)
Expand Down Expand Up @@ -242,7 +242,7 @@ def forward(self, x):

# Again, grab a single mini-batch of images
dataiter = iter(training_loader)
images, labels = dataiter.next()
images, labels = next(dataiter)

# add_graph() will trace the sample input through your model,
# and render it as a graph.
Expand Down
2 changes: 1 addition & 1 deletion beginner_source/introyt/trainingyt.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def matplotlib_imshow(img, one_channel=False):
plt.imshow(np.transpose(npimg, (1, 2, 0)))

dataiter = iter(training_loader)
images, labels = dataiter.next()
images, labels = next(dataiter)

# Create a grid from the images and show them
img_grid = torchvision.utils.make_grid(images)
Expand Down
2 changes: 1 addition & 1 deletion intermediate_source/tensorboard_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ using `make_grid <https://pytorch.org/vision/stable/utils.html#torchvision.utils
# get some random training images
dataiter = iter(trainloader)
images, labels = dataiter.next()
images, labels = next(dataiter)
# create grid of images
img_grid = torchvision.utils.make_grid(images)
Expand Down

0 comments on commit 7d8cb43

Please sign in to comment.