Reputation: 2471
I am trying to compute the hessian on a neural network using theano.
However, I cannot compute the hessian on my loss function with respect to a weight matrix W
. The hessian needs to be computed with respect to a vector v
.
So, a way around this is to flatten the weight matrix into a vector, then compute the hessian, etc.
Once I am done updating my weight matrix in flattened form, I need to rebuild my weight matrix with the original dimensions, say m x n
What is the most efficient way to do this using theano syntax?
Upvotes: 0
Views: 760
Reputation: 21
It sounds like your looking for "reshape", like @Pushkin mentioned.
You can use reshape in Theano just like Numpy, but it's with their custom tensor object.
Upvotes: 2