Solved by albanD in post #2 
              
              
                Hi, 
If you know during the forward which part you want to block the gradients from, you can use .detach() on the output of this block to exclude it from the backward. 
If you only know after the forward which part you want to block, you will need to add a hook to the Tensor that is the output of yo…