Skip to content
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

intro to pytorch: Part 2, next() is not a method #410

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
" \n",
"# obtain one batch of training images\n",
"dataiter = iter(train_loader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"images = images.numpy()\n",
"\n",
"# plot the images in the batch, along with the corresponding labels\n",
Expand Down Expand Up @@ -360,7 +360,7 @@
"source": [
"# obtain one batch of test images\n",
"dataiter = iter(test_loader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"\n",
"# get sample outputs\n",
"output = model(images)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
"source": [
"# Grab some data \n",
"dataiter = iter(trainloader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"\n",
"# Resize images into a 1D vector, new shape is (batch size, color channels, image pixels) \n",
"images.resize_(64, 1, 784)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
],
"source": [
"dataiter = iter(trainloader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"print(type(images))\n",
"print(images.shape)\n",
"print(labels.shape)"
Expand Down Expand Up @@ -650,7 +650,7 @@
"source": [
"# Grab some data \n",
"dataiter = iter(trainloader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"\n",
"# Resize images into a 1D vector, new shape is (batch size, color channels, image pixels) \n",
"images.resize_(64, 1, 784)\n",
Expand Down
2 changes: 1 addition & 1 deletion intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"# Test out your network!\n",
"\n",
"dataiter = iter(testloader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"img = images[1]\n",
"\n",
"# TODO: Calculate the class probabilities (softmax) for img\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
"model.eval()\n",
"\n",
"dataiter = iter(testloader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"img = images[0]\n",
"# Convert 2D image to 1D vector\n",
"img = img.view(1, 784)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
"model.eval()\n",
"\n",
"dataiter = iter(testloader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"img = images[0]\n",
"# Convert 2D image to 1D vector\n",
"img = img.view(1, 784)\n",
Expand Down