I've trained a neural network (NN) on a problem where multiple inputs can be mapped to the same output. I'd like to use this NN to go from an output to an input i.e. given an output vector $y$, I want to find an input $x$ such that the NN returns some $z$ close to the given output $y$ when fed an input of $x$.
I was thinking of using gradient descent to do this. Do any of the common deep learning APIs let you take gradients of NNs with respect to their inputs?
I've looked around and haven't found anything, but figured I'd check here before moving forward.