add code to forward prop before loss calculation

This commit is contained in:
yunjey
2017-03-13 19:16:19 +09:00
parent a500ce7396
commit 651e901806

View File

@ -72,6 +72,7 @@ optimizer.step()
# linear.bias.data.sub_(0.01 * linear.bias.grad.data)
# Print out the loss after optimization.
pred = linear(x)
loss = criterion(pred, y)
print('loss after 1 step optimization: ', loss.data[0])