3

I'd like to get the jacobian of dy/dx in keras, I'm using theano as the backend.

What what
  • 527
  • 4
  • 15
  • 1
    Please show your effort. [This](http://stackoverflow.com/q/42792405/1586200) question is a good starting point. It discusses Jacobian and Hessian. – Autonomous Mar 23 '17 at 00:01
  • When using Theano backend you have access to a method (`theano.gradient.jacobian()`) for calculating the jacobian: http://deeplearning.net/software/theano/library/gradient.html#theano.gradient.jacobian – Simon Mar 23 '17 at 03:17
  • Gotcha, I was trying theano.function([model.layers[0].input], T.jacobian(model.layers[-1].output.flatten(), model.layers[0].input)) but the output shape was weird. (number of items * output size, number of items, input size) – What what Mar 23 '17 at 10:37
  • 1
    How can we compute it if the backend is tensorflow? – Maystro Jun 17 '19 at 14:59

0 Answers0