Check for internal memory overlap in some indexing-type functions (#43423)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/43423
Test Plan: Imported from OSS
Reviewed By: ezyang
Differential Revision: D23298652
Pulled By: zou3519
fbshipit-source-id: c13c59aec0c6967ef0d6365d782c1f4c98c04227