In fact,you can read the official document,the torch.no_grad() in the part of doc which called torch.autograd,https://pytorch.org/docs/stable/autograd.html#locally-disable-grad 168
In addition,the Variable() function return a torch tensor,which is equal tensor(requires_grad=False)
The Variable API has been deprecated: Variables are no longer necessary to use autograd with tensors. Autograd automatically supports Tensors with  requires_grad  set to  True . Below please find a quick guide on what has changed:


Variable(tensor)  and  Variable(tensor, requires_grad) still work as expected, but they return Tensors instead of Variables.
EA61F70A-7CFD-4B48-8AB7-B7CC04CDD81C.png750×1334 145 KB