Eigenvectors computation algorithm


I was doing some dependency reductions in my code and noticed that tf.linalg.ein and np.linalg.ein return different eigenvectors. I understand that they are different only up to some constant, but I’d love to be able to recreate my code 1:1.

My question is – how does tf compute eigenvectors? If it makes any difference, I’m using tf 2.7 on Win10.


Welcome to the Tensorflow Forum!

I have observed that the issue doesn’t exist in latest tensorflow 2.12 where as the issue exist in tensorflow 2.7. Please find the gist for reference.

Could you please check in latest tensorflow 2.12 and see if you still see the difference?

Thank you!


Thanks for answering! The 2.12 version seems to be working as I would expect, however, as I noted, that’s not the version I’m using in the project and not the version I want my code to reflect the behavior of. I’m interested in the algorithm of version 2.7.



Sorry for the late response. Unfortunately, unless it is a security bug, code fixes cannot be performed in older versions.

Thank you!