@tom:  I understand that the current functionality is available in torch, but this piece of code is only a simplified version of what I want to implement with the goal of finding the bugs.
My main goal is to compute the top-1 eigenvector and its derivative of a batch of matrices.
Can you take a brief look and see my mistake in it?