Add streams boundary check to `torch::cuda::scatter`` (#53057)
Summary:
Accessing elements of `std::vector` outside of its boundaries can lead to crashes/memory corruptions
Fixes https://github.com/pytorch/pytorch/issues/52526
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53057
Reviewed By: janeyx99
Differential Revision: D26736829
Pulled By: malfet
fbshipit-source-id: 7aa13c53c8d062adfef082153809a7a724a74ee5