In this case, the arguments given to the model should have their grads updated but the model’s own parameters shouldn’t. None of the  no_grad  systems allow for that specificity do they?
To explain the context, in DDPG we have a Q model which learns predicted rewards for state/action pairs, and a policy model which learns to choose the policy for a state. The Q model is trained from observed rewards. The policy model is trained by feeding its output into the Q model and doing gradient ascent to tweak the policy in the direction of a larger predicted reward. These both happen side-by-side in the same training loop.
The tricky bit is feeding the policy actions into the Q model to do the gradient ascent without also training the Q model. The  requires_grad  method works, but doing it in a more declarative way would require some way to tell it to only calculate grads back through a specific tensor or something like that. Like with torch.no_grad(except = policy_actions):