add deterministic path for index_copy_cpu (#56900)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56900
use serial copy with iter.serial_for_each in the deterministic mode
Test Plan:
buck test mode/opt //caffe2/test:torch -- test_index_copy_deterministic
✓ Pass: caffe2/test:torch - test_index_copy_deterministic_cpu (test_torch.TestTorchDeviceTypeCPU) (5.581)
buck test mode/opt //caffe2/test:torch_cuda -- test_nondeterministic_alert_index_copy
✓ ListingSuccess: caffe2/test:torch_cuda - main (11.565)
✓ Pass: caffe2/test:torch_cuda - test_nondeterministic_alert_index_copy_cuda_float64 (test_torch.TestTorchDeviceTypeCUDA) (29.172)
✓ Pass: caffe2/test:torch_cuda - main (29.172)
Reviewed By: ngimel
Differential Revision: D27992992
fbshipit-source-id: cebeefd8508553f9dbc4145819fe90dd625502f3