[ONNX] Add additional_test_kwargs into test_fx_to_onnx_with_onnxruntime.py (#99434)
1. Expand additional_test_inputs to include kwargs
2. Revisit and update tests status by adding ops
3. Disabling dtype -1 assignment avoids potential bugs
4. Expand input/output to accept buit-in type, but they are not dynamically captured by dynamo.export right now, and they would be added as constant input to op.targets.
5. Move run_test_with_fx_to_onnx_exporter_and_onnx_runtime to onnx_test_common.py
<!--
copilot:all
-->
### <samp>๐ค Generated by Copilot at 3c03579</samp>
### Summary
๐ ๏ธ๐งช๐
<!--
1. ๐ ๏ธ for updating the `filter_incompatible_and_dtype_convert_kwargs` function
2. ๐งช for updating the test function and test cases
3. ๐ for adding support for new operators and scalar types
-->
This pull request improves the ONNX export support for scalar types and some ATen operators in PyTorch. It updates the test framework, the input and output adapters, the function dispatcher and the ONNX script generator to handle these cases. It also fixes or removes some failing or outdated tests.
> _We defy the limits of the ONNX script_
> _We export the models with scalar and copy_
> _We filter and convert the kwargs of dtype_
> _We run the tests with FX and docstring_
### Walkthrough
* Update the `_InputArgsType` type annotation and the `_run_test_with_fx_to_onnx_exporter_and_onnx_runtime` function signature and docstring to handle int, float and bool inputs for some ONNX operators ([link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL44-R46), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL144-R157), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL155-R164), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL162-R172), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL201-R224), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L197-R199), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L291-R293))
* Update the `filter_incompatible_and_dtype_convert_kwargs` function to omit the `dtype` argument if it is None ([link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-cabc3e58713d6fe7ab764ade4f2692f6753402322a7b542397cad16fcc72cf4bL203-R205))
* Update the test cases in `test_fx_to_onnx_with_onnxruntime.py` to use the `input_kwargs` parameter as a mapping, to fix the format of the `additional_test_inputs` parameter, and to add or remove `xfail`, `skip_dynamic_fx_test` and `skip_min_ort_version` decorators as needed ([link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL320-R336), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL330-R353), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL357-R380), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL452-L470), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL488-R486), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL509-R510), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbR543), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL559-R565), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL578-R580), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL597-R599), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL611-R620), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL636-R636), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL656-R659), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL672-R675), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL691-R698), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL709-R714), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL732-R730), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL752-R750), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL773-R771), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbR797-R803), [link](https://github.com/pytorch/pytorch/pull/99434/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL807-R816))
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99434
Approved by: https://github.com/justinchuby