Okay. I looked into this a little bit, and I think I have some more insight into what’s going on.
I don’t 100% understand the math behind your code, but I’ve noticed the following:
When one sends the identity matrix through torch.eig() (or something very close to it) it seems like it just returns any vector as the eigenvectors. For example, in a 2 x 2 case:

(the top is the original vector L and the bottom is the result of v, w = torch.eig(L, eigenvectors=True)).
Does your code rely on any properties of the returned eigenvectors? I know torch.symeig is nice because the returned eigenvectors are guaranteed to satisfy L = V W V^T