Changing the backward graph

I want to separate the computation of the gradients of the intermediate tensors (activations), from the computation of the parameter gradients into two separate passes. Is this possible to do with pytroch?