How about defining a hook? Would that solve your problem? E.g., something like
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
 
        self.gradients = []

        ## your layers
        self.some_conv_layer.register_backward_hook(self.save_gradients)
        
    def forward(self, x):
        ## your forward pass
        return F.softmax(logits)

    def save_gradients(self, module, grad_input, grad_output):
        self.gradients.append(grad_output)

model = MyModel()
output = model(x)
output.backward()

print(model.gradients)