Hi,
How do you define your custom CUDA function? 
If you use autograd.Function in python to create new autograd Functions, you need to make sure that your backward can be auto-diffed. If it cannot, then your backward should call the apply of another Function that corresponds to your backward and double-backward.