Gradient of NN output with respect to inputs 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.
Yes there is. This is called "back-propagation to the input". I would like to invite you to read this awesome blog which relies on lucid. You will see some code on their notebooks.