Skip to content

Update next(iter) to align with Python3 #2087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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