Solved by albanD in post #4 
              
              
                Hi, 
If you just want to use a different grad_output from the provided one, you can just use a hook on the output: 
output.register_hook(lambda grad: new_val)

In your forward pass in whatever function uses your custom autograd.Function.