Use of Variable

I have some problems with how to use ‘Variable’.

  1. Which parameter should be ‘Variable’ when I achieve a network?

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.