Hi all,
How can I check whether rquires_grad of a variable is True or False?. Can I set the requires_grad by x.requires_grad=True? (x is a variable).
Thanks in advance
Hi all,
How can I check whether rquires_grad of a variable is True or False?. Can I set the requires_grad by x.requires_grad=True? (x is a variable).
Thanks in advance
You can check with print(x.requires_grad)
You can set it with x.requires_grad_(true)
: https://pytorch.org/docs/master/tensors.html?highlight=requires_grad#torch.Tensor.requires_grad_