IMO, gradients are recorded only when the tensor is initialized with requires_grad=True
.
In addition to this, if a tensor is initialized with requires_grad=False
, then the gradients are not recorded even w/o the with torch.no_grad()
context or/nor model.eval()
.
Am I wrong?