Skip to content

Commit 304c0b2

Browse files
authored
Merge pull request #31 from Hierom/patch-1
Fixing error learning rate for this sample
2 parents b161aa0 + 410f7ec commit 304c0b2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tutorial-contents-notebooks/301_regression.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
},
126126
"outputs": [],
127127
"source": [
128-
"optimizer = torch.optim.SGD(net.parameters(), lr=0.5)\n",
128+
"optimizer = torch.optim.SGD(net.parameters(), lr=0.2)\n",
129129
"loss_func = torch.nn.MSELoss() # this is for regression mean squared loss"
130130
]
131131
},
@@ -261,9 +261,9 @@
261261
" plt.cla()\n",
262262
" plt.scatter(x.data.numpy(), y.data.numpy())\n",
263263
" plt.plot(x.data.numpy(), prediction.data.numpy(), 'r-', lw=5)\n",
264-
" plt.text(0.5, 0, 'Loss=%.4f' % loss.data[0], fontdict={'size': 20, 'color': 'red'})\n",
264+
" plt.text(0.5, 0, 'Loss=%.4f' % loss.data.numpy(), fontdict={'size': 20, 'color': 'red'})\n",
265265
" plt.show()\n",
266-
" plt.pause(0.2)\n",
266+
" plt.pause(0.1)\n",
267267
"\n",
268268
"plt.ioff()\n"
269269
]

0 commit comments

Comments
 (0)