That’s what the error was suggesting but apparently torch.mm 6 returns a tensor and not a variable.
I don’t know why are you getting an error in the first place cuz I tried following code and it didn’t give any error:

mat1 = torch.randn(3, 3)
torch.inverse(torch.mm(mat1, mat1.t()))