[cudnn] Computing the gradient with respect to the input

I am looking to compute the gradient of a neural network with one output node with respect to the input to the neural network. Is there some way to hack cudnnConvolutionBackwardData, cudnnActivationBackward etc to do this?

Many thanks