Out.backward() and weight access

Hey there, Can I run a backward pass only on an intermediate step? I need to access the weights after that step in the forward function without backpropagating through it.

Yes, and if this is part of a module, you can use a module forward hook to save that intermediate to a global, and at the end of the forward, call .backward() on that intermediate.