Getting an error when inverting an integer type matrix in torch
I was attempting to find the inverse of a 3x3 matrix that is composed of random integers using: torch.randint(). However, when doing so, I was getting the error: &quot;inverse_cpu&quot; not implemented for 'Long'
The code:
A = torch.randint(0, 10, (3, 3))
A_inv = A.inverse()
print(A @ A_inv, &quot;\n&quot;, A_inv @ A)

I believe that A.inverse() is expecting the inverse of matrix A to also be of type integer, but it's not. Maybe we can have it such that matrix A is of type float like torch.Tensor(), or have A_inv invert it regardless. Though I'm not quite sure how to do either.
Thanks for your assistance!

Okay I figured out 2 ways to do this:
1.) A = torch.randint(0, 10, (3, 3), dtype=torch.float32)
2.) A = torch.Tensor(np.random.randint(0, 10, (3, 3)))
And then inverting either gives no errors, as both are of type float32 now.
