Raise an error if torch.cat is given `out` as one of the input tensors (#30577)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/30562 for both cpu and cuda.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30577
Differential Revision: D19298732
Pulled By: ezyang
fbshipit-source-id: ea539c97493ee17d8f60b1134d100a44c8717578