Can I use @torch.no_grad() upon classes?

Is it okay to use the decorator @torch.no_grad() upon classes?
Or should I put the decorator on every method of a class?

Thank you in advance.

Hi,

I don’t think you can actually decorate a class definition in python.
You will have to do it for each function one by one I’m afraid.

No worries. Thank you again.