cs230-code-examples icon indicating copy to clipboard operation
cs230-code-examples copied to clipboard

modified loss as per new pytorch version

Open vganesh46 opened this issue 6 years ago • 0 comments

Before Pytorch 0.4.0., loss was a Variable wrapping a tensor of size (1,), but in 0.4.0 loss is now a scalar and has 0 dimensions. Indexing into a scalar doesn’t make sense (it gives a warning now, but will be a hard error in 0.5.0). Use loss.item() to get the Python number from a scalar.

https://pytorch.org/blog/pytorch-0_4_0-migration-guide/

vganesh46 avatar Feb 12 '19 07:02 vganesh46