I discovered that there are singular matrices when doing SVD decomposition - as part of doing PCA. I’m using torch.pca_lowrank(matrix,...) to do dimensional reduction. You can check whether the middle vector has zeros in it (singular values), e.g.
reduced, eigenvalues, _ = torch.pca_lowrank(matrix, q=4)
if not eigenvalues.prod().is_nonzero():
    raise Exception

Hope it helps.