Skip to content

Commit

Permalink
intro to pytorch: Part 2, next() is not a method
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimPushtaev committed Mar 2, 2023
1 parent c9404fc commit 78e3873
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
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

0 comments on commit 78e3873

Please sign in to comment.