Skip to content

Commit 23f2a3f

Browse files
authored
Refactor FashionMNIST notebook to use next() for data iterator and fix subplot division (#3322)
1 parent ac89ed3 commit 23f2a3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/notebooks/FashionMNIST.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@
605605
"classes = ['T-shirt/top','Trouser','Pullover','Dress','Coat','Sandal','Shirt','Sneaker','Bag','Ankle Boot']\n",
606606
"# creating iterator for iterating the dataset\n",
607607
"dataiter = iter(val_loader)\n",
608-
"images, labels = dataiter.next()\n",
608+
"images, labels = next(dataiter)\n",
609609
"images_arr = []\n",
610610
"labels_arr = []\n",
611611
"pred_arr = []\n",
@@ -621,7 +621,7 @@
621621
"# plotting the results\n",
622622
"fig = plt.figure(figsize=(25,4))\n",
623623
"for i in range(10):\n",
624-
" ax = fig.add_subplot(2, 20/2, i+1, xticks=[], yticks=[])\n",
624+
" ax = fig.add_subplot(2, 20//2, i+1, xticks=[], yticks=[])\n",
625625
" ax.imshow(images_arr[i].resize_(1, 28, 28).numpy().squeeze())\n",
626626
" ax.set_title(\"{} ({})\".format(classes[pred_arr[i]], classes[labels_arr[i]]),\n",
627627
" color=(\"green\" if pred_arr[i]==labels_arr[i] else \"red\"))"

0 commit comments

Comments
 (0)