Li-Huai (Allan) Lin
d9a7e93aaf
[ONNX] Add dtype check in onnx verification ( #79263 )
...
Currently we don't have a dtype check in verifying the consistency between PyTorch and ONNX outputs. As a result, some of dtype inconsistencies were found and reported: #77842 #77845
This is a POC.
Failed workflows:
- [linux-xenial-py3.7-clang7-onnx / test (default, 2, 2, linux.2xlarge)]
- inconsistent shape
- TestONNXRuntime_opset10.test_all (#79371 )
- TestONNXRuntime_opset10.test_any (#79371 )
- TestONNXRuntime_opset10.test_argmin_argmax (#79503 )
- TestONNXRuntime_opset10.test_hardshrink (#79695 )
- TestONNXRuntime_opset10.test_linalg_norm (#79506 )
- TestONNXRuntime_opset10.test_linalg_vector_norm (#79506 )
- TestONNXRuntime_opset10.test_prelu_scalar (#79846 )
- TestONNXRuntime_opset10.test_softshrink (#79695 )
- TestONNXRuntime_opset10.test_sum_empty_tensor (skipped)
- TestONNXRuntime_opset10.test_tolist (skipped)
- inconsistent dtype
- test_arithmetic_prim_bool (skipped)
- test_arithmeticOps_with_low_precision (skipped)
- test_arithmetic_prim_float (skipped)
- test_logical_and (#79339 )
- test_logical_or (#79339 )
- test_logical_xor (#79339 )
- test_pow (skipped)
- test_primitive_input_floating (skipped)
- test_quantize_per_tensor (#79690 )
- test_quantized_adaptive_avg_pool2d (#79690 )
- test_quantized_arithmetic (#79690 )
- test_quantized_arithmetic_qfunctional (#79690 )
- test_quantized_conv2d (#79690 )
- test_quantized_conv2d_relu (#79690 )
- test_quantized_flatten (#79690 )
- test_quantized_hardsigmoid (#79690 )
- test_quantized_hardswish (#79690 )
- test_quantized_linear (#79690 )
- test_quantized_sigmoid (#79690 )
- test_item (skipped)
- test_full_like_value (skipped)
- TestONNXRuntime_opset7.test_div_rounding_mode (skipped)
- TestONNXRuntime_opset8.test_div_rounding_mode (skipped)
- TestONNXRuntime_opset9.test_div_rounding_mode (skipped)
- TestONNXRuntime_opset9_IRv4.test_div_rounding_mode (skipped)
- test_outer (skipped)
- test_symbolic_shape_inference_arange_2 (skipped)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79263
Approved by: https://github.com/justinchuby , https://github.com/BowenBao
2022-08-10 07:14:12 +00:00
Wei-Sheng Chin
4a34cbc7cd
[ONNX] exporter native_layer_norm ( #81754 )
...
Pytorch has two similar layer normalization symbols `aten::layer_norm` and `aten::native_layer_norm`. This PR reuses `aten::layer_norm`'s exporter for exporting `aten::native_layer_norm` with a small refinement. A test is also included. This PR is required because JIT graphs generated from TorchDynamo and LazyTensor (with TS backend) may contain `native_layer_norm` instead of `layer_norm`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81754
Approved by: https://github.com/BowenBao , https://github.com/justinchuby
2022-07-27 00:30:19 +00:00
Wei-Sheng Chin
b7f9315eac
[ONNX] Export aten::native_dropout ( #81743 )
...
This PR adds exporter for `aten::native_dropout` with a test.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81743
Approved by: https://github.com/BowenBao , https://github.com/justinchuby
2022-07-26 21:47:06 +00:00
Wei-Sheng Chin
6691ed7884
[ONNX] Export aten::_log_softmax ( #81804 )
...
As title. We are seeing more aten symbols when exporting JIT graph from TorchDynamo and LazyTensor.
Fixes #81939
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81804
Approved by: https://github.com/BowenBao
2022-07-25 22:02:56 +00:00
Wei-Sheng Chin
e32691dc7a
[ONNX] extend add and sub exporter to cover graph non-tensor inputs ( #81736 )
...
ONNX exporter fails when the 3rd input of `aten:add` or `aten::sub` isn't a tensor. This PR fixes this failure.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81736
Approved by: https://github.com/BowenBao
2022-07-25 21:54:52 +00:00
Wei-Sheng Chin
1a9317ca64
[ONNX] Export aten::convolution ( #81815 )
...
As title. We encountered this symbol when running MNIST CNN from LazyTensor.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81815
Approved by: https://github.com/BowenBao
2022-07-25 17:08:01 +00:00
Justin Chu
773d80747c
[ONNX] Clean up unit tests, rename files and improve import style ( #81141 )
...
- Rename `test_pytorch_common` -> `pytorch_test_common`, `test_onnx_common` -> `onnx_test_common`, removing the test_ prefix to show that the files are not test cases
- Remove import * in `test_pytorch_common` and adjust to import from `testing._internal.common_utils` (where functions are actually defined) instead
- Import modules only in `test_pytorch_onnx_onnxruntime` (too many to handle in a single PR in other tests) (The skips are exceptions)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81141
Approved by: https://github.com/BowenBao
2022-07-12 00:00:49 +00:00
Jane Xu
d2fbfe7fce
[ONNX] subscribe onnx to our custom test infra ( #79546 )
...
Remove as many references as can be easily done of unittest in favor of our custom infra.
Left a todo where I could not easily replace unittest.main with run_tests()
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79546
Approved by: https://github.com/seemethere
2022-06-15 15:00:04 +00:00
BowenBao
6883b0ce9f
[ONNX][WIP] Refactor verification.py
...
* Rename arguments, code clean up.
* Refactor functions to smaller reusable functions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77289
Approved by: https://github.com/justinchuby , https://github.com/garymm
2022-05-31 18:49:39 +00:00
BowenBao
483bb4f0cb
[ONNX] Extract export verification as standalone api from unittest
...
The verification logic is refactored and extracted from
`test_pytorch_onnx_onnxruntime.py`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76929
Approved by: https://github.com/justinchuby , https://github.com/garymm
2022-05-26 19:49:19 +00:00
Justin Chu
5dd1c67776
[ONNX] Format ONNX python with black
...
Format all onnx python code with black and isort with
```sh
isort torch/onnx/ test/onnx
black torch/onnx/ test/onnx
```
Updated lintrunner config to include these paths.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76754
Approved by: https://github.com/suo , https://github.com/BowenBao
2022-05-05 00:19:22 +00:00
BowenBao
1793ab0bd2
[ONNX] Initial test suite for Torch IR to ONNX
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74492
Approved by: https://github.com/shubhambhokare1 , https://github.com/garymm
2022-04-11 19:28:28 +00:00