Fixed out= variant of linalg.inv (#51977)
Summary:
This PR modifies the behavior of the `linalg_inv_out` variant to match the description here https://github.com/pytorch/pytorch/wiki/Developer-FAQ#how-does-out-work-in-pytorch
With this PR result and input tensors must be on the same device and have the same "type kind".
It's allowed to pass out tensors with complex dtypes for float inputs.
Ref. https://github.com/pytorch/pytorch/issues/42666
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51977
Reviewed By: H-Huang
Differential Revision: D26725718
Pulled By: mruberry
fbshipit-source-id: 2acc2a311328268706ce27ce060fc88fc7416753