I have some problems with how to use ‘Variable’.
- Which parameter should be ‘Variable’ when I achieve a network?
I have some problems with how to use ‘Variable’.
Since PyTorch 0.4.0
you don’t have to use Variables
anymore.
You can use tensors
now and set requires_grad=True
, if you need the gradient for this tensor.
If you don’t need gradients at all, e.g. for validation, wrap your code in with torch.no_grad():
. This was previously achieved by setting volatile=True
using Variables
.