From 5b3bdff259eec73865981cb4d0b50df1e3d4b057 Mon Sep 17 00:00:00 2001 From: Akihiro Inui Date: Sun, 16 Jun 2019 23:14:15 +0200 Subject: [PATCH] Fixed 05_linear_regression.py To extract loss, loss.data[0] did not work so I removed [0] and it worked. --- 05_linear_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_linear_regression.py b/05_linear_regression.py index 0afd430..542489e 100644 --- a/05_linear_regression.py +++ b/05_linear_regression.py @@ -41,7 +41,7 @@ def forward(self, x): # Compute and print loss loss = criterion(y_pred, y_data) - print(epoch, loss.data[0]) + print(epoch, loss.data) # Zero gradients, perform a backward pass, and update the weights. optimizer.zero_grad()