Hi,
There is:


loss the Variable,

loss.data the (presumably size 1) Tensor,

loss.data[0] the (python) float at position 0 in the tensor.

As such, by just using loss.data you would not run into the “keeping track over everything” problem (which would happen if you use loss and something is not volatile), but you would add torch tensors instead of just python numbers.
Best regards
Thomas