Scipy is most likely computing the eigenvalues in double precision, while
pytorch is most likely doing so in single precision. Try performing your
pytorch in double precision and see if that resolves (or at least reduces)
your issue.
If not, please post a simple, fully-self-contained, runnable script that
reproduces this discrepancy, together with the output you get when you
run it.
Thank you so much.
I didn’t know about precision.
I actually solved this issue with Tikhonov regularization: adding np.finfo(np.float32).eps on diagonal entries