Compare reconstructions, not singular vectors
SVD factors may differ by sign, or rotate within tied singular subspaces. So when checking NumPy against PyTorch, compare reconstructed matrices and singular values — never the singular vectors themselves.
The notebook’s cross-check uses a float64 CPU torch.linalg.svd and compares the rank-20 reconstruction, after asserting there is a gap between the 20th and 21st singular values.
If a truncation cuts through tied singular values, even the optimal reconstruction need not be unique.