tjoseph:

Could you tell me why to use the method? In PyTorch docs requires_grad is set directly all the time.


First, let me admit that there is a modicum of taste here.

I sometimes misspell requires.
I find myself thinking of “set requires grad to true” as an operation I apply to a tensor rather than the change of a data member. In other words, setting the gradient requirement is more “typical use of an object-modifying-method” than "typical use of =" to me.

Best regards
Thomas