Hi @Rahul_pillai
with torch.no_grad():
is used to locally turn of the gradient tracking.
@torch.no_grad() is another option to turn off gradients and is used with a function. So anytime this function is called the its gradient tracking will offed locally within the execution of this function. Few examples can be found at link 5