From 78e38737b8d10ccdc7fcd3cbff26ce0bbce093d5 Mon Sep 17 00:00:00 2001 From: Vadim Pushtaev Date: Tue, 28 Feb 2023 23:27:11 +0200 Subject: [PATCH] intro to pytorch: Part 2, next() is not a method --- .../Part 2 - Neural Networks in PyTorch (Exercises).ipynb | 2 +- .../Part 2 - Neural Networks in PyTorch (Solution).ipynb | 4 ++-- intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb | 2 +- .../Part 5 - Inference and Validation (Exercises).ipynb | 2 +- .../Part 5 - Inference and Validation (Solution).ipynb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Exercises).ipynb b/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Exercises).ipynb index b6591c9c21..a507ec4560 100644 --- a/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Exercises).ipynb +++ b/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Exercises).ipynb @@ -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", diff --git a/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Solution).ipynb b/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Solution).ipynb index 77ba591ad1..0b0bbba1e0 100644 --- a/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Solution).ipynb +++ b/intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Solution).ipynb @@ -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)" @@ -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", diff --git a/intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb b/intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb index ad60cbf16c..69bc607552 100644 --- a/intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb +++ b/intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb @@ -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", diff --git a/intro-to-pytorch/Part 5 - Inference and Validation (Exercises).ipynb b/intro-to-pytorch/Part 5 - Inference and Validation (Exercises).ipynb index 989eaee9aa..7225aedba7 100644 --- a/intro-to-pytorch/Part 5 - Inference and Validation (Exercises).ipynb +++ b/intro-to-pytorch/Part 5 - Inference and Validation (Exercises).ipynb @@ -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", diff --git a/intro-to-pytorch/Part 5 - Inference and Validation (Solution).ipynb b/intro-to-pytorch/Part 5 - Inference and Validation (Solution).ipynb index 33275ecc37..9fcaea85b1 100644 --- a/intro-to-pytorch/Part 5 - Inference and Validation (Solution).ipynb +++ b/intro-to-pytorch/Part 5 - Inference and Validation (Solution).ipynb @@ -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",