New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ONNX] Add additional_test_kwargs into test_fx_to_onnx_with_onnxruntime.py #99434
Conversation
…me.py [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/99434
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit f836124: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…me.py ghstack-source-id: d7808fa51412e55efd4234f10adce0ee30ab23dd Pull Request resolved: #99434
copilot:all |
…h_onnxruntime.py" [ghstack-poisoned]
…me.py ghstack-source-id: 01716dab3990b5845ff82d2a4e6bd25d88084436 Pull Request resolved: #99434
Has to be in the main pr description section |
…h_onnxruntime.py" 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. <!-- 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)) [ghstack-poisoned]
…me.py ghstack-source-id: 9859f4624ce929f446b6783b96fbc4e844ee08cd Pull Request resolved: #99434
Should be merged after #99434 [ghstack-poisoned]
Should be merged after #99434 [ghstack-poisoned]
…h_onnxruntime.py" 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. <!-- 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)) [ghstack-poisoned]
…me.py ghstack-source-id: 0746b45f7f44a64b8bd5769347fa76691c654e80 Pull Request resolved: #99434
) | ||
|
||
@pytorch_test_common.xfail( | ||
"RuntimeError: Unknown call_function target: aten.copy.default" | ||
"RuntimeError: Unknown call_function target: aten.lift_fresh_copy.default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 is this a new op in the family
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's just not implemented yet.
@@ -140,3 +154,199 @@ def _run_test(m, remained_onnx_input_idx, flatten=True, ignore_none=True): | |||
) | |||
if not is_model_script and not self.is_script: | |||
_run_test(model, tracing_remained_onnx_input_idx) | |||
|
|||
@_beartype.beartype | |||
def run_test_with_fx_to_onnx_exporter_and_onnx_runtime( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a method in the test class or can it be a global function? Prefer a global function if it does not require states in self?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm thought about that, but the function requires test_suite attributes: op_level_debug and dynamic_shapes. We could move it globally, but will need to impot class TestFx... to annotate, which is cons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG! This is good then imo
@BowenBao PTAL |
…h_onnxruntime.py" 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)) [ghstack-poisoned]
…me.py ghstack-source-id: d3245ec44db2d0d9a464943e1f4b557a336e84cd Pull Request resolved: #99434
"typing.Sequence[torch.Tensor], as tuple index 1 item float 8.0 not " | ||
"instance of <protocol 'torch.Tensor'>." | ||
"https://github.com/pytorch/pytorch/issues/99534" | ||
"To make it work, convert the float argument into a 0d tensor" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we still want to keep this test. xfail seems fine.
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Should be merged after #99434 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at f59c428</samp> ### Summary 📝🔄🚀 <!-- 1. 📝 - This emoji represents the improvement of the documentation and type annotation of the ONNX exporter and its tests. 2. 🔄 - This emoji represents the renaming of the `dont_care` function to `skip` and the update of the references and documentation. This change reflects a refactoring and improvement of the code quality and readability. 3. 🚀 - This emoji represents the enhancement of the ONNX exporter's ability to handle more input and output types for PyTorch models. This change increases the performance and functionality of the exporter. --> This pull request enhances the ONNX exporter and its tests to handle more input and output types for PyTorch models. It improves the type annotation, tolerance handling, and documentation of the exporter and its test functions. It also renames a test function to make the code more consistent and clear. > _To export PyTorch models with ONNX_ > _We need to handle various contexts_ > _We improved the annotation_ > _And the tolerance function_ > _And renamed `dont_care` to `skip` for the tests_ ### Walkthrough * Expand the `_InputArgsType` type annotation to include int, float, and bool types, in addition to torch.Tensor, Sequence, and Mapping, to support more types of inputs for PyTorch models ([link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL44-R46), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L197-R199), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L291-R295)). [ghstack-poisoned]
Should be merged after #99434 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at f59c428</samp> ### Summary 📝🔄🚀 <!-- 1. 📝 - This emoji represents the improvement of the documentation and type annotation of the ONNX exporter and its tests. 2. 🔄 - This emoji represents the renaming of the `dont_care` function to `skip` and the update of the references and documentation. This change reflects a refactoring and improvement of the code quality and readability. 3. 🚀 - This emoji represents the enhancement of the ONNX exporter's ability to handle more input and output types for PyTorch models. This change increases the performance and functionality of the exporter. --> This pull request enhances the ONNX exporter and its tests to handle more input and output types for PyTorch models. It improves the type annotation, tolerance handling, and documentation of the exporter and its test functions. It also renames a test function to make the code more consistent and clear. > _To export PyTorch models with ONNX_ > _We need to handle various contexts_ > _We improved the annotation_ > _And the tolerance function_ > _And renamed `dont_care` to `skip` for the tests_ ### Walkthrough * Expand the `_InputArgsType` type annotation to include int, float, and bool types, in addition to torch.Tensor, Sequence, and Mapping, to support more types of inputs for PyTorch models ([link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL44-R46), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L197-R199), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L291-R295)). [ghstack-poisoned]
Should be merged after #99434 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at f59c428</samp> ### Summary 📝🔄🚀 <!-- 1. 📝 - This emoji represents the improvement of the documentation and type annotation of the ONNX exporter and its tests. 2. 🔄 - This emoji represents the renaming of the `dont_care` function to `skip` and the update of the references and documentation. This change reflects a refactoring and improvement of the code quality and readability. 3. 🚀 - This emoji represents the enhancement of the ONNX exporter's ability to handle more input and output types for PyTorch models. This change increases the performance and functionality of the exporter. --> This pull request enhances the ONNX exporter and its tests to handle more input and output types for PyTorch models. It improves the type annotation, tolerance handling, and documentation of the exporter and its test functions. It also renames a test function to make the code more consistent and clear. > _To export PyTorch models with ONNX_ > _We need to handle various contexts_ > _We improved the annotation_ > _And the tolerance function_ > _And renamed `dont_care` to `skip` for the tests_ ### Walkthrough * Expand the `_InputArgsType` type annotation to include int, float, and bool types, in addition to torch.Tensor, Sequence, and Mapping, to support more types of inputs for PyTorch models ([link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL44-R46), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L197-R199), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L291-R295)). [ghstack-poisoned]
Should be merged after #99434 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at f59c428</samp> ### Summary 📝🔄🚀 <!-- 1. 📝 - This emoji represents the improvement of the documentation and type annotation of the ONNX exporter and its tests. 2. 🔄 - This emoji represents the renaming of the `dont_care` function to `skip` and the update of the references and documentation. This change reflects a refactoring and improvement of the code quality and readability. 3. 🚀 - This emoji represents the enhancement of the ONNX exporter's ability to handle more input and output types for PyTorch models. This change increases the performance and functionality of the exporter. --> This pull request enhances the ONNX exporter and its tests to handle more input and output types for PyTorch models. It improves the type annotation, tolerance handling, and documentation of the exporter and its test functions. It also renames a test function to make the code more consistent and clear. > _To export PyTorch models with ONNX_ > _We need to handle various contexts_ > _We improved the annotation_ > _And the tolerance function_ > _And renamed `dont_care` to `skip` for the tests_ ### Walkthrough * Expand the `_InputArgsType` type annotation to include int, float, and bool types, in addition to torch.Tensor, Sequence, and Mapping, to support more types of inputs for PyTorch models ([link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL44-R46), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L197-R199), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L291-R295)). [ghstack-poisoned]
Should be merged after #99434 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at f59c428</samp> ### Summary 📝🔄🚀 <!-- 1. 📝 - This emoji represents the improvement of the documentation and type annotation of the ONNX exporter and its tests. 2. 🔄 - This emoji represents the renaming of the `dont_care` function to `skip` and the update of the references and documentation. This change reflects a refactoring and improvement of the code quality and readability. 3. 🚀 - This emoji represents the enhancement of the ONNX exporter's ability to handle more input and output types for PyTorch models. This change increases the performance and functionality of the exporter. --> This pull request enhances the ONNX exporter and its tests to handle more input and output types for PyTorch models. It improves the type annotation, tolerance handling, and documentation of the exporter and its test functions. It also renames a test function to make the code more consistent and clear. > _To export PyTorch models with ONNX_ > _We need to handle various contexts_ > _We improved the annotation_ > _And the tolerance function_ > _And renamed `dont_care` to `skip` for the tests_ ### Walkthrough * Expand the `_InputArgsType` type annotation to include int, float, and bool types, in addition to torch.Tensor, Sequence, and Mapping, to support more types of inputs for PyTorch models ([link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL44-R46), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L197-R199), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L291-R295)). [ghstack-poisoned]
Should be merged after #99434 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at f59c428</samp> ### Summary 📝🔄🚀 <!-- 1. 📝 - This emoji represents the improvement of the documentation and type annotation of the ONNX exporter and its tests. 2. 🔄 - This emoji represents the renaming of the `dont_care` function to `skip` and the update of the references and documentation. This change reflects a refactoring and improvement of the code quality and readability. 3. 🚀 - This emoji represents the enhancement of the ONNX exporter's ability to handle more input and output types for PyTorch models. This change increases the performance and functionality of the exporter. --> This pull request enhances the ONNX exporter and its tests to handle more input and output types for PyTorch models. It improves the type annotation, tolerance handling, and documentation of the exporter and its test functions. It also renames a test function to make the code more consistent and clear. > _To export PyTorch models with ONNX_ > _We need to handle various contexts_ > _We improved the annotation_ > _And the tolerance function_ > _And renamed `dont_care` to `skip` for the tests_ ### Walkthrough * Expand the `_InputArgsType` type annotation to include int, float, and bool types, in addition to torch.Tensor, Sequence, and Mapping, to support more types of inputs for PyTorch models ([link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-c8fa56eefd7f98fb4f9739d57df57f02ede77e28528133736010a6d06651ebcbL44-R46), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L197-R199), [link](https://github.com/pytorch/pytorch/pull/99465/files?diff=unified&w=0#diff-0795f54fd1f38cfbf2c4a863a4efc9f40f2ea020a2b1612605c361b8d8d35862L291-R295)). [ghstack-poisoned]
Stack from ghstack (oldest at bottom):
🤖 Generated by Copilot at 3c03579
Summary
🛠️🧪🚀
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.
Walkthrough
_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, link, link, link, link, link, link)filter_incompatible_and_dtype_convert_kwargs
function to omit thedtype
argument if it is None (link)test_fx_to_onnx_with_onnxruntime.py
to use theinput_kwargs
parameter as a mapping, to fix the format of theadditional_test_inputs
parameter, and to add or removexfail
,skip_dynamic_fx_test
andskip_min_ort_version
decorators as needed (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)