[ONNX] Support index_add_ function. (#56867) (#57830)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57830
This is PR is aiming to support tensor.index_add_() method in symbolic function. We leverage scatter_add() to implement this function while ONNX doesn't have a corresponding operator.
Notes:
1. 4 tests have been added for some scenarios.
2. If there are duplicated value in 'index' parameter, the export will still execute successfully but the results are wrong. Add a warning for every call to this symbolic function. And if we detect that the rank of 'index' is greater than the size of the 'dim' dimension, will raise an exception to stop exporting an incorrect ONNX file.
Test Plan: Imported from OSS
Reviewed By: malfet
Differential Revision: D28393518
Pulled By: SplitInfinity
fbshipit-source-id: f487ca2c63fec47c6ab74f1a7783dae7f3b8d1ef
Co-authored-by: Jay Zhang <jiz@microsoft.com>