I have a 3d tensor A of shape (b, c, c) and I think that torch.inverse(A) is much faster on GPU then applying torch.inverse(A[i,:,:]) for all i in a loop. The issue is that some of A[i,:,:] might be singular and torch.inverse throws a runtime error. How can I circumvent this while still enjoying fast computation?