Matrix Inversion RuntimeError: MAGMA getrf

Hi,

I’m using matrix inversing function to run the following code but meet the RuntimeError:

GD = torch.mm(D.t(),D).cuda()
torch.mm(D, GD.inverse())

RuntimeError: MAGMA getrf : U(33,33) is 0, U is singular at /pytorch/torch/lib/THC/generic/THCTensorMathMagma.cu:374

Could anybody help me on this? Thanks a lot!

You should make sure that GD is nonsingular (, and it’s eigenvalues are not very small to avoid numerical issues).

1 Like

Thanks Simon for reminding! It does show that the GD is singular originally. We fixed it.