Skip to content

Commit 0212a9d

Browse files
authored
Fixing error learning rate for this sample
1 parent d053113 commit 0212a9d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tutorial-contents-notebooks/301_regression.ipynb

Lines changed: 2 additions & 2 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.4)\n",
129129
"loss_func = torch.nn.MSELoss() # this is for regression mean squared loss"
130130
]
131131
},
@@ -261,7 +261,7 @@
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.item(), fontdict={'size': 20, 'color': 'red'})\n",
265265
" plt.show()\n",
266266
" plt.pause(0.2)\n",
267267
"\n",

0 commit comments

Comments
 (0)