Add checks for structured in-place operations. (#65686)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65686
Fixes: #57827
This PR introduces `check_inplace` function. It contains some common checks for all
structured in-place operators (e.g. dtype, device, and sizes). `set_output` method calls
`check_inplace` on in-place specializations of structured kernels.
Besides that, it also:
- adds overlap assertions for both in-place and out-of-place overloads
- remove in-place operator specific `TORCH_CHECK` around the code base
Test Plan: Imported from OSS
Reviewed By: albanD
Differential Revision: D31234063
Pulled By: ezyang
fbshipit-source-id: fa3b45775af7812e07a282e7cae00b68caf0fdb0