From ca374773b451c11964648a1e68e81674dbabc581 Mon Sep 17 00:00:00 2001 From: Gary Miguel Date: Wed, 6 Apr 2022 16:56:19 -0700 Subject: [PATCH] [ONNX] update default opset_version to 13 (#73898) Summary: And add a new tool to update it in the future, which follows the policy of using "latest as of 18 months ago". This policy is meant to balance: * recent enough to increase the odds of being able to successfully export * old enough to increase the odds of exported model being runnable by different ONNX implementations Related changes: * test_models.py: explicitly fix opset_version to 9 rather than relying on default. Caffe2 doesn't support newer versions. * symbolic_helper.py: * Remove a misleading comment * Remove unnecessary check in `_set_opset_version` * Use a range to define `_onnx_stable_opsets` * test_pytorch_common.py: * Rename a variable from min -> max. I think it was a copy-paste error. * Make skip test messages more informative. * Remove unused `skipIfONNXShapeInference`. More on that below. * test_pytorch_onnx_onnxruntime.py: * Make all the `TestCase` classes explicitly specify opset version. * Make `test_unsupported_pad` respect `opset_version` by using `run_test` * Unrelated simplification: make it obvious that all tests run with `onnx_shape_inference=True`. AFAICT this was already the case. * There was one test that was entirely disabled (test_tolist) because it was asking to be skipped whenever `onnx_shape_inference=True`, but it was always True. I changed the model being tested so as to preserve the intended test coverage but still have the test actually pass. Pull Request resolved: https://github.com/pytorch/pytorch/pull/73898 Reviewed By: msaroufim Differential Revision: D35264615 Pulled By: malfet fbshipit-source-id: cda8fbdffe4cc8210d8d96e659e3a9adf1b5f1d2 (cherry picked from commit b5e639e88828d34442282d0b50c977e610a2ba3a) --- scripts/onnx/test.sh | 2 +- test/jit/test_export_modes.py | 4 +- .../expect/TestOperators.test_acos.expect | 4 +- .../TestOperators.test_add_broadcast.expect | 4 +- ...stOperators.test_add_left_broadcast.expect | 4 +- ...tOperators.test_add_size1_broadcast.expect | 4 +- ...tors.test_add_size1_right_broadcast.expect | 4 +- ....test_add_size1_singleton_broadcast.expect | 4 +- .../TestOperators.test_addconstant.expect | 4 +- .../expect/TestOperators.test_addmm.expect | 4 +- .../expect/TestOperators.test_argmax.expect | 9 +- .../expect/TestOperators.test_asin.expect | 4 +- .../expect/TestOperators.test_at_op.expect | 4 +- .../expect/TestOperators.test_atan.expect | 4 +- .../TestOperators.test_avg_pool2d.expect | 53 +-- .../expect/TestOperators.test_baddbmm.expect | 4 +- .../expect/TestOperators.test_basic.expect | 4 +- .../TestOperators.test_batchnorm.expect | 4 +- .../TestOperators.test_batchnorm_1d.expect | 4 +- ...stOperators.test_batchnorm_noaffine.expect | 4 +- ...tOperators.test_batchnorm_onnx_irv4.expect | 4 +- ...stOperators.test_batchnorm_training.expect | 4 +- .../expect/TestOperators.test_chunk.expect | 158 +++++++- .../expect/TestOperators.test_clip.expect | 30 +- .../expect/TestOperators.test_clip_max.expect | 28 +- .../expect/TestOperators.test_clip_min.expect | 28 +- .../expect/TestOperators.test_concat2.expect | 4 +- .../expect/TestOperators.test_conv.expect | 4 +- .../TestOperators.test_conv_onnx_irv4.expect | 4 +- .../TestOperators.test_convtranspose.expect | 4 +- .../onnx/expect/TestOperators.test_cos.expect | 4 +- .../expect/TestOperators.test_dict.expect | 4 +- .../expect/TestOperators.test_dict_str.expect | 4 +- .../onnx/expect/TestOperators.test_dim.expect | 4 +- .../expect/TestOperators.test_dropout.expect | 4 +- .../TestOperators.test_dropout_default.expect | 51 ++- ...TestOperators.test_dropout_training.expect | 51 ++- .../onnx/expect/TestOperators.test_elu.expect | 4 +- .../TestOperators.test_embedding_bags.expect | 362 ++++++++++++++++-- .../TestOperators.test_empty_like.expect | 4 +- .../expect/TestOperators.test_equal.expect | 4 +- .../onnx/expect/TestOperators.test_erf.expect | 4 +- .../onnx/expect/TestOperators.test_exp.expect | 4 +- .../expect/TestOperators.test_expand.expect | 4 +- .../expect/TestOperators.test_flatten.expect | 80 ++-- .../TestOperators.test_flatten2D.expect | 4 +- .../TestOperators.test_frobenius_norm.expect | 46 ++- .../expect/TestOperators.test_full.expect | 4 +- .../TestOperators.test_full_like.expect | 4 +- .../expect/TestOperators.test_gather.expect | 112 +----- test/onnx/expect/TestOperators.test_ge.expect | 26 +- .../expect/TestOperators.test_gelu.expect | 4 +- test/onnx/expect/TestOperators.test_gt.expect | 4 +- .../expect/TestOperators.test_hardtanh.expect | 44 ++- .../TestOperators.test_implicit_expand.expect | 4 +- .../expect/TestOperators.test_index.expect | 4 +- .../expect/TestOperators.test_isnan.expect | 4 +- .../TestOperators.test_layer_norm_aten.expect | 4 +- test/onnx/expect/TestOperators.test_le.expect | 26 +- .../expect/TestOperators.test_linear.expect | 4 +- .../TestOperators.test_log_sigmoid.expect | 4 +- .../TestOperators.test_logsoftmax.expect | 4 +- test/onnx/expect/TestOperators.test_lt.expect | 4 +- .../onnx/expect/TestOperators.test_max.expect | 4 +- .../expect/TestOperators.test_maxpool.expect | 9 +- .../TestOperators.test_maxpool_indices.expect | 73 +++- .../expect/TestOperators.test_mean.expect | 4 +- .../TestOperators.test_mean_dtype.expect | 4 +- .../expect/TestOperators.test_meshgrid.expect | 4 +- .../onnx/expect/TestOperators.test_min.expect | 4 +- test/onnx/expect/TestOperators.test_mm.expect | 25 +- .../expect/TestOperators.test_narrow.expect | 44 ++- test/onnx/expect/TestOperators.test_ne.expect | 4 +- .../expect/TestOperators.test_nonzero.expect | 4 +- .../expect/TestOperators.test_norm_p1.expect | 4 +- .../expect/TestOperators.test_norm_p2.expect | 4 +- .../TestOperators.test_ones_like.expect | 4 +- .../onnx/expect/TestOperators.test_pad.expect | 201 +++++++++- .../expect/TestOperators.test_params.expect | 4 +- ...TestOperators.test_params_onnx_irv4.expect | 4 +- .../expect/TestOperators.test_permute2.expect | 4 +- .../onnx/expect/TestOperators.test_pow.expect | 4 +- .../expect/TestOperators.test_prelu.expect | 14 +- .../expect/TestOperators.test_prod.expect | 4 +- .../TestOperators.test_prod_dtype.expect | 4 +- .../expect/TestOperators.test_rand.expect | 4 +- .../expect/TestOperators.test_randn.expect | 4 +- ...rs.test_reduce_sum_negative_indices.expect | 30 +- .../TestOperators.test_reduced_mean.expect | 4 +- ...stOperators.test_reduced_mean_dtype.expect | 4 +- ...Operators.test_reduced_mean_keepdim.expect | 4 +- .../TestOperators.test_reduced_prod.expect | 4 +- ...stOperators.test_reduced_prod_dtype.expect | 4 +- ...Operators.test_reduced_prod_keepdim.expect | 4 +- .../TestOperators.test_reduced_sum.expect | 31 +- ...estOperators.test_reduced_sum_dtype.expect | 34 +- ...tOperators.test_reduced_sum_keepdim.expect | 30 +- .../TestOperators.test_reducemax.expect | 4 +- .../TestOperators.test_reducemin.expect | 4 +- .../TestOperators.test_remainder.expect | 4 +- .../expect/TestOperators.test_repeat.expect | 4 +- ...tOperators.test_repeat_dim_overflow.expect | 4 +- .../expect/TestOperators.test_rrelu.expect | 4 +- .../expect/TestOperators.test_rsqrt.expect | 4 +- .../expect/TestOperators.test_rsub.expect | 4 +- .../TestOperators.test_scatter_add.expect | 20 +- .../expect/TestOperators.test_selu.expect | 4 +- .../TestOperators.test_shape_value_map.expect | 120 +++--- .../expect/TestOperators.test_sign.expect | 4 +- .../onnx/expect/TestOperators.test_sin.expect | 4 +- .../expect/TestOperators.test_slice.expect | 77 +++- .../expect/TestOperators.test_split.expect | 36 +- ...TestOperators.test_split_with_sizes.expect | 36 +- .../expect/TestOperators.test_sqrt.expect | 4 +- .../onnx/expect/TestOperators.test_std.expect | 4 +- .../onnx/expect/TestOperators.test_sum.expect | 4 +- .../TestOperators.test_sum_dtype.expect | 4 +- .../onnx/expect/TestOperators.test_tan.expect | 4 +- .../TestOperators.test_transpose.expect | 4 +- .../expect/TestOperators.test_type_as.expect | 4 +- .../expect/TestOperators.test_unfold.expect | 168 +++++--- .../TestOperators.test_unsqueeze.expect | 30 +- ...erators.test_upsample_nearest_scale.expect | 40 +- ..._nearest_scale_default_scale_factor.expect | 40 +- ...perators.test_upsample_nearest_size.expect | 110 +++++- .../expect/TestOperators.test_view.expect | 4 +- .../TestOperators.test_view_flatten.expect | 12 +- .../TestOperators.test_zeros_like.expect | 4 +- test/onnx/test_models.py | 6 +- test/onnx/test_pytorch_common.py | 19 +- test/onnx/test_pytorch_onnx_caffe2.py | 3 +- .../test_pytorch_onnx_caffe2_quantized.py | 8 +- test/onnx/test_pytorch_onnx_onnxruntime.py | 184 +++------ .../eager/test_quantize_eager_ptq.py | 3 +- tools/onnx/update_default_opset_version.py | 78 ++++ torch/onnx/__init__.py | 2 +- torch/onnx/symbolic_helper.py | 34 +- 137 files changed, 1962 insertions(+), 1025 deletions(-) create mode 100755 tools/onnx/update_default_opset_version.py diff --git a/scripts/onnx/test.sh b/scripts/onnx/test.sh index 3b39f6005876..dbeb6b2b27f5 100755 --- a/scripts/onnx/test.sh +++ b/scripts/onnx/test.sh @@ -69,7 +69,7 @@ if [[ "$BUILD_ENVIRONMENT" == *ort_test1* || "${SHARD_NUMBER}" == "1" ]]; then pytest "${args[@]}" \ "$top_dir/test/onnx/test_pytorch_onnx_onnxruntime.py::TestONNXRuntime_opset7" \ "$top_dir/test/onnx/test_pytorch_onnx_onnxruntime.py::TestONNXRuntime_opset8" \ - "$top_dir/test/onnx/test_pytorch_onnx_onnxruntime.py::TestONNXRuntime" \ + "$top_dir/test/onnx/test_pytorch_onnx_onnxruntime.py::TestONNXRuntime_opset9" \ "$top_dir/test/onnx/test_custom_ops.py" \ "$top_dir/test/onnx/test_models_onnxruntime.py" \ "$top_dir/test/onnx/test_utility_funs.py" \ diff --git a/test/jit/test_export_modes.py b/test/jit/test_export_modes.py index 70d2193201a3..300be7d9dd69 100644 --- a/test/jit/test_export_modes.py +++ b/test/jit/test_export_modes.py @@ -82,7 +82,9 @@ def forward(self, x, y): ModelWithAtenNotONNXOp(), (x, y), add_node_names=False, do_constant_folding=False, - operator_export_type=OperatorExportTypes.ONNX_ATEN_FALLBACK) + operator_export_type=OperatorExportTypes.ONNX_ATEN_FALLBACK, + # support for linalg.qr was added in later op set versions. + opset_version=9) # torch.fmod is using to test ONNX_ATEN. # If you plan to remove fmod from aten, or found this test failed. diff --git a/test/onnx/expect/TestOperators.test_acos.expect b/test/onnx/expect/TestOperators.test_acos.expect index bcf946395610..40fc61e29b7f 100644 --- a/test/onnx/expect/TestOperators.test_acos.expect +++ b/test/onnx/expect/TestOperators.test_acos.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_add_broadcast.expect b/test/onnx/expect/TestOperators.test_add_broadcast.expect index 72d69469339f..569b2400df88 100644 --- a/test/onnx/expect/TestOperators.test_add_broadcast.expect +++ b/test/onnx/expect/TestOperators.test_add_broadcast.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -57,5 +57,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_add_left_broadcast.expect b/test/onnx/expect/TestOperators.test_add_left_broadcast.expect index 81a0689a51bd..ffa632ca475b 100644 --- a/test/onnx/expect/TestOperators.test_add_left_broadcast.expect +++ b/test/onnx/expect/TestOperators.test_add_left_broadcast.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -57,5 +57,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_add_size1_broadcast.expect b/test/onnx/expect/TestOperators.test_add_size1_broadcast.expect index ffdf6efd6228..9917880a8a22 100644 --- a/test/onnx/expect/TestOperators.test_add_size1_broadcast.expect +++ b/test/onnx/expect/TestOperators.test_add_size1_broadcast.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -60,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_add_size1_right_broadcast.expect b/test/onnx/expect/TestOperators.test_add_size1_right_broadcast.expect index 72d69469339f..569b2400df88 100644 --- a/test/onnx/expect/TestOperators.test_add_size1_right_broadcast.expect +++ b/test/onnx/expect/TestOperators.test_add_size1_right_broadcast.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -57,5 +57,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_add_size1_singleton_broadcast.expect b/test/onnx/expect/TestOperators.test_add_size1_singleton_broadcast.expect index a00ddab51e96..96d2dca59325 100644 --- a/test/onnx/expect/TestOperators.test_add_size1_singleton_broadcast.expect +++ b/test/onnx/expect/TestOperators.test_add_size1_singleton_broadcast.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -60,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_addconstant.expect b/test/onnx/expect/TestOperators.test_addconstant.expect index 8494b62a3ed7..0e1570eb62da 100644 --- a/test/onnx/expect/TestOperators.test_addconstant.expect +++ b/test/onnx/expect/TestOperators.test_addconstant.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -57,5 +57,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_addmm.expect b/test/onnx/expect/TestOperators.test_addmm.expect index ee46983d9e41..1ef0a81e2a90 100644 --- a/test/onnx/expect/TestOperators.test_addmm.expect +++ b/test/onnx/expect/TestOperators.test_addmm.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -102,5 +102,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_argmax.expect b/test/onnx/expect/TestOperators.test_argmax.expect index a10b3bbe3289..38add716ff36 100644 --- a/test/onnx/expect/TestOperators.test_argmax.expect +++ b/test/onnx/expect/TestOperators.test_argmax.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -17,6 +17,11 @@ graph { i: 0 type: INT } + attribute { + name: "select_last_index" + i: 0 + type: INT + } } name: "torch_jit" input { @@ -50,5 +55,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_asin.expect b/test/onnx/expect/TestOperators.test_asin.expect index a6197dea5ffe..f5a44b850eb1 100644 --- a/test/onnx/expect/TestOperators.test_asin.expect +++ b/test/onnx/expect/TestOperators.test_asin.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_at_op.expect b/test/onnx/expect/TestOperators.test_at_op.expect index 346cf77df974..8d4ba07ddcc8 100644 --- a/test/onnx/expect/TestOperators.test_at_op.expect +++ b/test/onnx/expect/TestOperators.test_at_op.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -54,5 +54,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_atan.expect b/test/onnx/expect/TestOperators.test_atan.expect index d9a034a25042..c8d189e1415e 100644 --- a/test/onnx/expect/TestOperators.test_atan.expect +++ b/test/onnx/expect/TestOperators.test_atan.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_avg_pool2d.expect b/test/onnx/expect/TestOperators.test_avg_pool2d.expect index cb5da7e05037..344022ec2688 100644 --- a/test/onnx/expect/TestOperators.test_avg_pool2d.expect +++ b/test/onnx/expect/TestOperators.test_avg_pool2d.expect @@ -1,40 +1,43 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { + node { + output: "onnx::Pad_1" + name: "Constant_0" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 8 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } node { input: "onnx::Pad_0" - output: "onnx::AveragePool_1" - name: "Pad_0" + input: "onnx::Pad_1" + output: "onnx::AveragePool_2" + name: "Pad_1" op_type: "Pad" attribute { name: "mode" s: "constant" type: STRING } - attribute { - name: "pads" - ints: 0 - ints: 0 - ints: 0 - ints: 0 - ints: 0 - ints: 0 - ints: 0 - ints: 0 - type: INTS - } - attribute { - name: "value" - f: 0 - type: FLOAT - } } node { - input: "onnx::AveragePool_1" - output: "2" - name: "AveragePool_1" + input: "onnx::AveragePool_2" + output: "3" + name: "AveragePool_2" op_type: "AveragePool" + attribute { + name: "ceil_mode" + i: 0 + type: INT + } attribute { name: "kernel_shape" ints: 3 @@ -80,7 +83,7 @@ graph { } } output { - name: "2" + name: "3" type { tensor_type { elem_type: 1 @@ -103,5 +106,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_baddbmm.expect b/test/onnx/expect/TestOperators.test_baddbmm.expect index 66fe45123b9f..fc7eb0f8295e 100644 --- a/test/onnx/expect/TestOperators.test_baddbmm.expect +++ b/test/onnx/expect/TestOperators.test_baddbmm.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -119,5 +119,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_basic.expect b/test/onnx/expect/TestOperators.test_basic.expect index 88d53eb0ff75..3d151aefabdb 100644 --- a/test/onnx/expect/TestOperators.test_basic.expect +++ b/test/onnx/expect/TestOperators.test_basic.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -76,5 +76,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_batchnorm.expect b/test/onnx/expect/TestOperators.test_batchnorm.expect index 1bd402f6533e..d9c9ec338c8c 100644 --- a/test/onnx/expect/TestOperators.test_batchnorm.expect +++ b/test/onnx/expect/TestOperators.test_batchnorm.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -145,5 +145,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_batchnorm_1d.expect b/test/onnx/expect/TestOperators.test_batchnorm_1d.expect index 426fb72af702..a4d2e1f10249 100644 --- a/test/onnx/expect/TestOperators.test_batchnorm_1d.expect +++ b/test/onnx/expect/TestOperators.test_batchnorm_1d.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -133,5 +133,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_batchnorm_noaffine.expect b/test/onnx/expect/TestOperators.test_batchnorm_noaffine.expect index 88f4fdc578f1..a421443cdcda 100644 --- a/test/onnx/expect/TestOperators.test_batchnorm_noaffine.expect +++ b/test/onnx/expect/TestOperators.test_batchnorm_noaffine.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -135,5 +135,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_batchnorm_onnx_irv4.expect b/test/onnx/expect/TestOperators.test_batchnorm_onnx_irv4.expect index 0d80bedd8ab5..a556e38c7198 100644 --- a/test/onnx/expect/TestOperators.test_batchnorm_onnx_irv4.expect +++ b/test/onnx/expect/TestOperators.test_batchnorm_onnx_irv4.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -93,5 +93,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_batchnorm_training.expect b/test/onnx/expect/TestOperators.test_batchnorm_training.expect index 9090a8ff1877..5e8f2049e143 100644 --- a/test/onnx/expect/TestOperators.test_batchnorm_training.expect +++ b/test/onnx/expect/TestOperators.test_batchnorm_training.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -149,5 +149,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_chunk.expect b/test/onnx/expect/TestOperators.test_chunk.expect index f49736760480..575245c807eb 100644 --- a/test/onnx/expect/TestOperators.test_chunk.expect +++ b/test/onnx/expect/TestOperators.test_chunk.expect @@ -1,28 +1,158 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::Split_0" - output: "1" - output: "2" - name: "Split_0" - op_type: "Split" + input: "onnx::Shape_0" + output: "onnx::Gather_1" + name: "Shape_0" + op_type: "Shape" + } + node { + output: "onnx::Gather_2" + name: "Constant_1" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Gather_1" + input: "onnx::Gather_2" + output: "onnx::Add_3" + name: "Gather_2" + op_type: "Gather" attribute { name: "axis" i: 0 type: INT } + } + node { + output: "onnx::Slice_4" + name: "Constant_3" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + output: "onnx::Add_5" + name: "Constant_4" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Add_3" + input: "onnx::Add_5" + output: "onnx::Div_6" + name: "Add_5" + op_type: "Add" + } + node { + output: "onnx::Div_7" + name: "Constant_6" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Div_6" + input: "onnx::Div_7" + output: "onnx::Mul_8" + name: "Div_7" + op_type: "Div" + } + node { + output: "onnx::Mul_9" + name: "Constant_8" + op_type: "Constant" attribute { - name: "split" - ints: 2 - ints: 1 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR } } + node { + input: "onnx::Mul_8" + input: "onnx::Mul_9" + output: "onnx::Slice_10" + name: "Mul_9" + op_type: "Mul" + } + node { + input: "onnx::Shape_0" + input: "onnx::Slice_4" + input: "onnx::Slice_10" + input: "onnx::Gather_2" + output: "11" + name: "Slice_10" + op_type: "Slice" + } + node { + output: "onnx::Mul_12" + name: "Constant_11" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Mul_8" + input: "onnx::Mul_12" + output: "onnx::Slice_13" + name: "Mul_12" + op_type: "Mul" + } + node { + input: "onnx::Shape_0" + input: "onnx::Slice_10" + input: "onnx::Slice_13" + input: "onnx::Gather_2" + output: "14" + name: "Slice_13" + op_type: "Slice" + } name: "torch_jit" input { - name: "onnx::Split_0" + name: "onnx::Shape_0" type { tensor_type { elem_type: 1 @@ -35,7 +165,7 @@ graph { } } output { - name: "1" + name: "11" type { tensor_type { elem_type: 1 @@ -48,7 +178,7 @@ graph { } } output { - name: "2" + name: "14" type { tensor_type { elem_type: 1 @@ -62,5 +192,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_clip.expect b/test/onnx/expect/TestOperators.test_clip.expect index 50293fd9cf94..81606851e785 100644 --- a/test/onnx/expect/TestOperators.test_clip.expect +++ b/test/onnx/expect/TestOperators.test_clip.expect @@ -1,24 +1,26 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "onnx::Clip_0" - output: "1" + input: "onnx::Clip_6" + input: "onnx::Clip_7" + output: "5" name: "Clip_0" op_type: "Clip" - attribute { - name: "max" - f: 0.5 - type: FLOAT - } - attribute { - name: "min" - f: -0.5 - type: FLOAT - } } name: "torch_jit" + initializer { + data_type: 1 + name: "onnx::Clip_6" + raw_data: "\000\000\000\277" + } + initializer { + data_type: 1 + name: "onnx::Clip_7" + raw_data: "\000\000\000?" + } input { name: "onnx::Clip_0" type { @@ -36,7 +38,7 @@ graph { } } output { - name: "1" + name: "5" type { tensor_type { elem_type: 1 @@ -53,5 +55,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_clip_max.expect b/test/onnx/expect/TestOperators.test_clip_max.expect index bb7bd0fc6db2..ceb89b3048c6 100644 --- a/test/onnx/expect/TestOperators.test_clip_max.expect +++ b/test/onnx/expect/TestOperators.test_clip_max.expect @@ -1,19 +1,21 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "onnx::Clip_0" - output: "1" + input: "" + input: "onnx::Clip_7" + output: "5" name: "Clip_0" op_type: "Clip" - attribute { - name: "max" - f: 0.1 - type: FLOAT - } } name: "torch_jit" + initializer { + data_type: 1 + name: "onnx::Clip_7" + raw_data: "\315\314\314=" + } input { name: "onnx::Clip_0" type { @@ -37,22 +39,22 @@ graph { } } output { - name: "1" + name: "5" type { tensor_type { elem_type: 1 shape { dim { - dim_value: 1 + dim_param: "Clip5_dim_0" } dim { - dim_value: 2 + dim_param: "Clip5_dim_1" } dim { - dim_value: 3 + dim_param: "Clip5_dim_2" } dim { - dim_value: 4 + dim_param: "Clip5_dim_3" } } } @@ -60,5 +62,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_clip_min.expect b/test/onnx/expect/TestOperators.test_clip_min.expect index cda3b105ccba..22826be3fd54 100644 --- a/test/onnx/expect/TestOperators.test_clip_min.expect +++ b/test/onnx/expect/TestOperators.test_clip_min.expect @@ -1,19 +1,21 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "onnx::Clip_0" - output: "1" + input: "onnx::Clip_7" + input: "" + output: "5" name: "Clip_0" op_type: "Clip" - attribute { - name: "min" - f: -0.1 - type: FLOAT - } } name: "torch_jit" + initializer { + data_type: 1 + name: "onnx::Clip_7" + raw_data: "\315\314\314\275" + } input { name: "onnx::Clip_0" type { @@ -37,22 +39,22 @@ graph { } } output { - name: "1" + name: "5" type { tensor_type { elem_type: 1 shape { dim { - dim_value: 1 + dim_param: "Clip5_dim_0" } dim { - dim_value: 2 + dim_param: "Clip5_dim_1" } dim { - dim_value: 3 + dim_param: "Clip5_dim_2" } dim { - dim_value: 4 + dim_param: "Clip5_dim_3" } } } @@ -60,5 +62,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_concat2.expect b/test/onnx/expect/TestOperators.test_concat2.expect index b5102e0f8664..f5b6aec0c229 100644 --- a/test/onnx/expect/TestOperators.test_concat2.expect +++ b/test/onnx/expect/TestOperators.test_concat2.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -65,5 +65,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_conv.expect b/test/onnx/expect/TestOperators.test_conv.expect index 55fe131ef3ac..f1078cef39c1 100644 --- a/test/onnx/expect/TestOperators.test_conv.expect +++ b/test/onnx/expect/TestOperators.test_conv.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -118,5 +118,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_conv_onnx_irv4.expect b/test/onnx/expect/TestOperators.test_conv_onnx_irv4.expect index 980f9fab61fc..18e3c683e9bc 100644 --- a/test/onnx/expect/TestOperators.test_conv_onnx_irv4.expect +++ b/test/onnx/expect/TestOperators.test_conv_onnx_irv4.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -96,5 +96,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_convtranspose.expect b/test/onnx/expect/TestOperators.test_convtranspose.expect index 22241584dc6c..0beedca2f292 100644 --- a/test/onnx/expect/TestOperators.test_convtranspose.expect +++ b/test/onnx/expect/TestOperators.test_convtranspose.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -124,5 +124,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_cos.expect b/test/onnx/expect/TestOperators.test_cos.expect index 7b08d883c7b8..1185bca62c59 100644 --- a/test/onnx/expect/TestOperators.test_cos.expect +++ b/test/onnx/expect/TestOperators.test_cos.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_dict.expect b/test/onnx/expect/TestOperators.test_dict.expect index 42a4855c818c..e041d535d768 100644 --- a/test/onnx/expect/TestOperators.test_dict.expect +++ b/test/onnx/expect/TestOperators.test_dict.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -60,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_dict_str.expect b/test/onnx/expect/TestOperators.test_dict_str.expect index 3e72400d5f42..eaab2752fb7d 100644 --- a/test/onnx/expect/TestOperators.test_dict_str.expect +++ b/test/onnx/expect/TestOperators.test_dict_str.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -63,5 +63,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_dim.expect b/test/onnx/expect/TestOperators.test_dim.expect index 77480e6173bb..59e910a646ca 100644 --- a/test/onnx/expect/TestOperators.test_dim.expect +++ b/test/onnx/expect/TestOperators.test_dim.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -28,5 +28,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_dropout.expect b/test/onnx/expect/TestOperators.test_dropout.expect index 407a1af477f7..27aab5c71821 100644 --- a/test/onnx/expect/TestOperators.test_dropout.expect +++ b/test/onnx/expect/TestOperators.test_dropout.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -42,5 +42,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_dropout_default.expect b/test/onnx/expect/TestOperators.test_dropout_default.expect index 523ec6bf8e30..89c0e988aacb 100644 --- a/test/onnx/expect/TestOperators.test_dropout_default.expect +++ b/test/onnx/expect/TestOperators.test_dropout_default.expect @@ -1,23 +1,46 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "x" - output: "onnx::ReduceMax_1" - output: "2" - name: "Dropout_0" - op_type: "Dropout" + output: "onnx::Dropout_1" + name: "Constant_0" + op_type: "Constant" + attribute { + name: "value" + t { + data_type: 1 + raw_data: "\000\000\000?" + } + type: TENSOR + } + } + node { + output: "onnx::Dropout_2" + name: "Constant_1" + op_type: "Constant" attribute { - name: "ratio" - f: 0.5 - type: FLOAT + name: "value" + t { + data_type: 9 + raw_data: "\001" + } + type: TENSOR } } node { - input: "onnx::ReduceMax_1" - output: "3" - name: "ReduceMax_1" + input: "x" + input: "onnx::Dropout_1" + input: "onnx::Dropout_2" + output: "onnx::ReduceMax_3" + output: "4" + name: "Dropout_2" + op_type: "Dropout" + } + node { + input: "onnx::ReduceMax_3" + output: "5" + name: "ReduceMax_3" op_type: "ReduceMax" attribute { name: "keepdims" @@ -43,7 +66,7 @@ graph { } } output { - name: "3" + name: "5" type { tensor_type { elem_type: 1 @@ -54,5 +77,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_dropout_training.expect b/test/onnx/expect/TestOperators.test_dropout_training.expect index 523ec6bf8e30..89c0e988aacb 100644 --- a/test/onnx/expect/TestOperators.test_dropout_training.expect +++ b/test/onnx/expect/TestOperators.test_dropout_training.expect @@ -1,23 +1,46 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "x" - output: "onnx::ReduceMax_1" - output: "2" - name: "Dropout_0" - op_type: "Dropout" + output: "onnx::Dropout_1" + name: "Constant_0" + op_type: "Constant" + attribute { + name: "value" + t { + data_type: 1 + raw_data: "\000\000\000?" + } + type: TENSOR + } + } + node { + output: "onnx::Dropout_2" + name: "Constant_1" + op_type: "Constant" attribute { - name: "ratio" - f: 0.5 - type: FLOAT + name: "value" + t { + data_type: 9 + raw_data: "\001" + } + type: TENSOR } } node { - input: "onnx::ReduceMax_1" - output: "3" - name: "ReduceMax_1" + input: "x" + input: "onnx::Dropout_1" + input: "onnx::Dropout_2" + output: "onnx::ReduceMax_3" + output: "4" + name: "Dropout_2" + op_type: "Dropout" + } + node { + input: "onnx::ReduceMax_3" + output: "5" + name: "ReduceMax_3" op_type: "ReduceMax" attribute { name: "keepdims" @@ -43,7 +66,7 @@ graph { } } output { - name: "3" + name: "5" type { tensor_type { elem_type: 1 @@ -54,5 +77,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_elu.expect b/test/onnx/expect/TestOperators.test_elu.expect index c43a3827fce9..9fc2d5aab1fe 100644 --- a/test/onnx/expect/TestOperators.test_elu.expect +++ b/test/onnx/expect/TestOperators.test_elu.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -60,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_embedding_bags.expect b/test/onnx/expect/TestOperators.test_embedding_bags.expect index 77dbd6a0a094..dfa1afddee30 100644 --- a/test/onnx/expect/TestOperators.test_embedding_bags.expect +++ b/test/onnx/expect/TestOperators.test_embedding_bags.expect @@ -1,47 +1,359 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "weight" - input: "input" - input: "offsets" - output: "3" - output: "4" + output: "onnx::Cast_3" + op_type: "Constant" + attribute { + name: "value" + t { + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Cast_3" + output: "onnx::Loop_4" + op_type: "Cast" + attribute { + name: "to" + i: 9 + type: INT + } + } + node { output: "5" - output: "6" - op_type: "ATen" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "input" + output: "onnx::Gather_6" + op_type: "Shape" + } + node { + output: "onnx::Gather_7" + op_type: "Constant" + attribute { + name: "value" + t { + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Gather_6" + input: "onnx::Gather_7" + output: "onnx::Unsqueeze_8" + op_type: "Gather" attribute { - name: "include_last_offset" + name: "axis" i: 0 type: INT } + } + node { + output: "onnx::Unsqueeze_9" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Unsqueeze_8" + input: "onnx::Unsqueeze_9" + output: "onnx::Concat_10" + op_type: "Unsqueeze" + } + node { + input: "offsets" + input: "onnx::Concat_10" + output: "onnx::Slice_11" + op_type: "Concat" attribute { - name: "mode" - i: 1 + name: "axis" + i: 0 type: INT } + } + node { + output: "onnx::Slice_12" + op_type: "Constant" attribute { - name: "operator" - s: "embedding_bag" - type: STRING + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_13" + op_type: "Constant" attribute { - name: "overload_name" - s: "" - type: STRING + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_14" + op_type: "Constant" attribute { - name: "scale_grad_by_freq" - i: 0 - type: INT + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\377\377\377\377\377\377\377\177" + } + type: TENSOR + } + } + node { + output: "onnx::Slice_15" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Slice_11" + input: "onnx::Slice_13" + input: "onnx::Slice_14" + input: "onnx::Slice_12" + input: "onnx::Slice_15" + output: "onnx::Shape_16" + op_type: "Slice" + } + node { + input: "onnx::Shape_16" + output: "onnx::Gather_17" + op_type: "Shape" + } + node { + output: "onnx::Gather_18" + op_type: "Constant" + attribute { + name: "value" + t { + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + input: "onnx::Gather_17" + input: "onnx::Gather_18" + output: "onnx::Loop_19" + op_type: "Gather" attribute { - name: "sparse" + name: "axis" i: 0 type: INT } } + node { + input: "onnx::Loop_19" + input: "onnx::Loop_4" + output: "20" + op_type: "Loop" + attribute { + name: "body" + g { + node { + input: "onnx::Slice_11" + input: "21" + output: "23" + name: "Gather_0" + op_type: "Gather" + attribute { + name: "axis" + i: 0 + type: INT + } + } + node { + input: "onnx::Shape_16" + input: "21" + output: "24" + name: "Gather_1" + op_type: "Gather" + attribute { + name: "axis" + i: 0 + type: INT + } + } + node { + output: "25" + name: "Constant_2" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "23" + input: "25" + output: "26" + name: "Unsqueeze_3" + op_type: "Unsqueeze" + } + node { + output: "27" + name: "Constant_4" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "24" + input: "27" + output: "28" + name: "Unsqueeze_5" + op_type: "Unsqueeze" + } + node { + input: "input" + input: "26" + input: "28" + input: "5" + output: "29" + name: "Slice_6" + op_type: "Slice" + } + node { + input: "weight" + input: "29" + output: "30" + name: "Gather_7" + op_type: "Gather" + attribute { + name: "axis" + i: 0 + type: INT + } + } + node { + input: "30" + output: "31" + name: "ReduceMean_8" + op_type: "ReduceMean" + attribute { + name: "axes" + ints: 0 + type: INTS + } + attribute { + name: "keepdims" + i: 0 + type: INT + } + } + node { + input: "onnx::Loop_4" + output: "32" + name: "Cast_9" + op_type: "Cast" + attribute { + name: "to" + i: 9 + type: INT + } + } + name: "torch_jit1" + input { + name: "21" + type { + tensor_type { + elem_type: 7 + shape { + } + } + } + } + input { + name: "22" + type { + tensor_type { + elem_type: 9 + shape { + } + } + } + } + output { + name: "32" + type { + tensor_type { + elem_type: 9 + shape { + } + } + } + } + output { + name: "31" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_param: "Loop20_dim_1" + } + } + } + } + } + } + type: GRAPH + } + } name: "torch_jit" initializer { dims: 10 @@ -93,16 +405,16 @@ graph { } } output { - name: "3" + name: "20" type { tensor_type { elem_type: 1 shape { dim { - dim_value: 1 + dim_param: "Loop20_dim_0" } dim { - dim_value: 8 + dim_param: "Loop20_dim_1" } } } @@ -110,5 +422,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_empty_like.expect b/test/onnx/expect/TestOperators.test_empty_like.expect index 1293acb1e16f..e4f6c6ede2ca 100644 --- a/test/onnx/expect/TestOperators.test_empty_like.expect +++ b/test/onnx/expect/TestOperators.test_empty_like.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -36,5 +36,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_equal.expect b/test/onnx/expect/TestOperators.test_equal.expect index 21c1e7f3caed..5a9877d484f8 100644 --- a/test/onnx/expect/TestOperators.test_equal.expect +++ b/test/onnx/expect/TestOperators.test_equal.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -72,5 +72,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_erf.expect b/test/onnx/expect/TestOperators.test_erf.expect index 6568ca8418d6..f8f70c37598d 100644 --- a/test/onnx/expect/TestOperators.test_erf.expect +++ b/test/onnx/expect/TestOperators.test_erf.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -55,5 +55,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_exp.expect b/test/onnx/expect/TestOperators.test_exp.expect index b270bab20975..49d9f74cb20d 100644 --- a/test/onnx/expect/TestOperators.test_exp.expect +++ b/test/onnx/expect/TestOperators.test_exp.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_expand.expect b/test/onnx/expect/TestOperators.test_expand.expect index 988830e43c83..6634173a0a63 100644 --- a/test/onnx/expect/TestOperators.test_expand.expect +++ b/test/onnx/expect/TestOperators.test_expand.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -131,5 +131,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_flatten.expect b/test/onnx/expect/TestOperators.test_flatten.expect index 48def60c9f25..12160e8b9e66 100644 --- a/test/onnx/expect/TestOperators.test_flatten.expect +++ b/test/onnx/expect/TestOperators.test_flatten.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -9,29 +9,59 @@ graph { op_type: "Shape" } node { - input: "onnx::Slice_1" - output: "onnx::Concat_2" - name: "Slice_1" - op_type: "Slice" + output: "onnx::Slice_2" + name: "Constant_1" + op_type: "Constant" attribute { - name: "axes" - ints: 0 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_3" + name: "Constant_2" + op_type: "Constant" attribute { - name: "ends" - ints: 0 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_4" + name: "Constant_3" + op_type: "Constant" attribute { - name: "starts" - ints: 0 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } } node { - output: "onnx::Concat_3" - name: "Constant_2" + input: "onnx::Slice_1" + input: "onnx::Slice_3" + input: "onnx::Slice_4" + input: "onnx::Slice_2" + output: "onnx::Concat_5" + name: "Slice_4" + op_type: "Slice" + } + node { + output: "onnx::Concat_6" + name: "Constant_5" op_type: "Constant" attribute { name: "value" @@ -44,10 +74,10 @@ graph { } } node { - input: "onnx::Concat_2" - input: "onnx::Concat_3" - output: "onnx::Reshape_4" - name: "Concat_3" + input: "onnx::Concat_5" + input: "onnx::Concat_6" + output: "onnx::Reshape_7" + name: "Concat_6" op_type: "Concat" attribute { name: "axis" @@ -57,9 +87,9 @@ graph { } node { input: "onnx::Shape_0" - input: "onnx::Reshape_4" - output: "5" - name: "Reshape_4" + input: "onnx::Reshape_7" + output: "8" + name: "Reshape_7" op_type: "Reshape" } name: "torch_jit" @@ -86,7 +116,7 @@ graph { } } output { - name: "5" + name: "8" type { tensor_type { elem_type: 1 @@ -100,5 +130,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_flatten2D.expect b/test/onnx/expect/TestOperators.test_flatten2D.expect index 041886291c9b..f60b1ba7066f 100644 --- a/test/onnx/expect/TestOperators.test_flatten2D.expect +++ b/test/onnx/expect/TestOperators.test_flatten2D.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -54,5 +54,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_frobenius_norm.expect b/test/onnx/expect/TestOperators.test_frobenius_norm.expect index b1af3261b0dd..fba4585b18b8 100644 --- a/test/onnx/expect/TestOperators.test_frobenius_norm.expect +++ b/test/onnx/expect/TestOperators.test_frobenius_norm.expect @@ -1,35 +1,49 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { + node { + output: "onnx::ReduceSum_1" + name: "Constant_0" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 2 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000" + } + type: TENSOR + } + } node { input: "x" input: "x" - output: "onnx::ReduceSum_1" - name: "Mul_0" + output: "onnx::ReduceSum_2" + name: "Mul_1" op_type: "Mul" } node { + input: "onnx::ReduceSum_2" input: "onnx::ReduceSum_1" - output: "onnx::Sqrt_2" - name: "ReduceSum_1" + output: "onnx::Sqrt_3" + name: "ReduceSum_2" op_type: "ReduceSum" - attribute { - name: "axes" - ints: 0 - ints: 1 - type: INTS - } attribute { name: "keepdims" i: 1 type: INT } + attribute { + name: "noop_with_empty_axes" + i: 0 + type: INT + } } node { - input: "onnx::Sqrt_2" - output: "3" - name: "Sqrt_2" + input: "onnx::Sqrt_3" + output: "4" + name: "Sqrt_3" op_type: "Sqrt" } name: "torch_jit" @@ -53,7 +67,7 @@ graph { } } output { - name: "3" + name: "4" type { tensor_type { elem_type: 1 @@ -73,5 +87,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_full.expect b/test/onnx/expect/TestOperators.test_full.expect index d3526e4b1c56..fc8acf5ee80d 100644 --- a/test/onnx/expect/TestOperators.test_full.expect +++ b/test/onnx/expect/TestOperators.test_full.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -36,5 +36,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_full_like.expect b/test/onnx/expect/TestOperators.test_full_like.expect index d3526e4b1c56..fc8acf5ee80d 100644 --- a/test/onnx/expect/TestOperators.test_full_like.expect +++ b/test/onnx/expect/TestOperators.test_full_like.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -36,5 +36,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_gather.expect b/test/onnx/expect/TestOperators.test_gather.expect index dde397e206cd..609f89853ac6 100644 --- a/test/onnx/expect/TestOperators.test_gather.expect +++ b/test/onnx/expect/TestOperators.test_gather.expect @@ -1,114 +1,22 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - output: "onnx::OneHot_2" - name: "Constant_0" - op_type: "Constant" - attribute { - name: "value" - t { - dims: 2 - data_type: 7 - raw_data: "\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000" - } - type: TENSOR - } - } - node { - output: "onnx::Gather_3" - name: "Constant_1" - op_type: "Constant" - attribute { - name: "value" - t { - dims: 1 - data_type: 7 - raw_data: "\001\000\000\000\000\000\000\000" - } - type: TENSOR - } - } - node { - input: "onnx::Shape_0" - output: "onnx::Gather_4" - name: "Shape_2" - op_type: "Shape" - } - node { - input: "onnx::Gather_4" - input: "onnx::Gather_3" - output: "onnx::OneHot_5" - name: "Gather_3" - op_type: "Gather" - attribute { - name: "axis" - i: 0 - type: INT - } - } - node { - input: "onnx::OneHot_1" - input: "onnx::OneHot_5" - input: "onnx::OneHot_2" - output: "onnx::Cast_6" - name: "OneHot_4" - op_type: "OneHot" + input: "onnx::GatherElements_0" + input: "onnx::GatherElements_1" + output: "2" + name: "GatherElements_0" + op_type: "GatherElements" attribute { name: "axis" i: 1 type: INT } } - node { - input: "onnx::Cast_6" - output: "onnx::Mul_7" - name: "Cast_5" - op_type: "Cast" - attribute { - name: "to" - i: 1 - type: INT - } - } - node { - input: "onnx::Shape_0" - output: "onnx::Mul_8" - name: "Unsqueeze_6" - op_type: "Unsqueeze" - attribute { - name: "axes" - ints: 2 - type: INTS - } - } - node { - input: "onnx::Mul_8" - input: "onnx::Mul_7" - output: "onnx::ReduceSum_9" - name: "Mul_7" - op_type: "Mul" - } - node { - input: "onnx::ReduceSum_9" - output: "10" - name: "ReduceSum_8" - op_type: "ReduceSum" - attribute { - name: "axes" - ints: 1 - type: INTS - } - attribute { - name: "keepdims" - i: 0 - type: INT - } - } name: "torch_jit" input { - name: "onnx::Shape_0" + name: "onnx::GatherElements_0" type { tensor_type { elem_type: 1 @@ -127,7 +35,7 @@ graph { } } input { - name: "onnx::OneHot_1" + name: "onnx::GatherElements_1" type { tensor_type { elem_type: 7 @@ -146,7 +54,7 @@ graph { } } output { - name: "10" + name: "2" type { tensor_type { elem_type: 1 @@ -166,5 +74,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_ge.expect b/test/onnx/expect/TestOperators.test_ge.expect index 5246ccf0eb76..8d578a4d25bd 100644 --- a/test/onnx/expect/TestOperators.test_ge.expect +++ b/test/onnx/expect/TestOperators.test_ge.expect @@ -1,23 +1,17 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::Less_0" - input: "onnx::Less_1" - output: "onnx::Not_2" - name: "Less_0" - op_type: "Less" - } - node { - input: "onnx::Not_2" - output: "3" - name: "Not_1" - op_type: "Not" + input: "onnx::GreaterOrEqual_0" + input: "onnx::GreaterOrEqual_1" + output: "2" + name: "GreaterOrEqual_0" + op_type: "GreaterOrEqual" } name: "torch_jit" input { - name: "onnx::Less_0" + name: "onnx::GreaterOrEqual_0" type { tensor_type { elem_type: 6 @@ -33,7 +27,7 @@ graph { } } input { - name: "onnx::Less_1" + name: "onnx::GreaterOrEqual_1" type { tensor_type { elem_type: 6 @@ -49,7 +43,7 @@ graph { } } output { - name: "3" + name: "2" type { tensor_type { elem_type: 9 @@ -66,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_gelu.expect b/test/onnx/expect/TestOperators.test_gelu.expect index d59cafa26178..dfc7d1d88468 100644 --- a/test/onnx/expect/TestOperators.test_gelu.expect +++ b/test/onnx/expect/TestOperators.test_gelu.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -122,5 +122,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_gt.expect b/test/onnx/expect/TestOperators.test_gt.expect index 903ea41b9051..5aab77798bf6 100644 --- a/test/onnx/expect/TestOperators.test_gt.expect +++ b/test/onnx/expect/TestOperators.test_gt.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -72,5 +72,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_hardtanh.expect b/test/onnx/expect/TestOperators.test_hardtanh.expect index 70a3732b2070..1268a4c14cfd 100644 --- a/test/onnx/expect/TestOperators.test_hardtanh.expect +++ b/test/onnx/expect/TestOperators.test_hardtanh.expect @@ -1,23 +1,41 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "input" - output: "1" - name: "Clip_0" - op_type: "Clip" + output: "onnx::Clip_1" + name: "Constant_0" + op_type: "Constant" attribute { - name: "max" - f: 0.5 - type: FLOAT + name: "value" + t { + data_type: 1 + raw_data: "\000\000\000\277" + } + type: TENSOR } + } + node { + output: "onnx::Clip_2" + name: "Constant_1" + op_type: "Constant" attribute { - name: "min" - f: -0.5 - type: FLOAT + name: "value" + t { + data_type: 1 + raw_data: "\000\000\000?" + } + type: TENSOR } } + node { + input: "input" + input: "onnx::Clip_1" + input: "onnx::Clip_2" + output: "3" + name: "Clip_2" + op_type: "Clip" + } name: "torch_jit" input { name: "input" @@ -36,7 +54,7 @@ graph { } } output { - name: "1" + name: "3" type { tensor_type { elem_type: 1 @@ -53,5 +71,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_implicit_expand.expect b/test/onnx/expect/TestOperators.test_implicit_expand.expect index db37957247fb..3c94edc85b4b 100644 --- a/test/onnx/expect/TestOperators.test_implicit_expand.expect +++ b/test/onnx/expect/TestOperators.test_implicit_expand.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -57,5 +57,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_index.expect b/test/onnx/expect/TestOperators.test_index.expect index 1ea803f067b7..330d2de0d7fc 100644 --- a/test/onnx/expect/TestOperators.test_index.expect +++ b/test/onnx/expect/TestOperators.test_index.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -59,5 +59,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_isnan.expect b/test/onnx/expect/TestOperators.test_isnan.expect index db7a68317500..198d3bdb2387 100644 --- a/test/onnx/expect/TestOperators.test_isnan.expect +++ b/test/onnx/expect/TestOperators.test_isnan.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -37,5 +37,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_layer_norm_aten.expect b/test/onnx/expect/TestOperators.test_layer_norm_aten.expect index f231db42fb54..d7b7ac561130 100644 --- a/test/onnx/expect/TestOperators.test_layer_norm_aten.expect +++ b/test/onnx/expect/TestOperators.test_layer_norm_aten.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -128,5 +128,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_le.expect b/test/onnx/expect/TestOperators.test_le.expect index c0b0d67f5a93..374a0d0e0d52 100644 --- a/test/onnx/expect/TestOperators.test_le.expect +++ b/test/onnx/expect/TestOperators.test_le.expect @@ -1,23 +1,17 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::Greater_0" - input: "onnx::Greater_1" - output: "onnx::Not_2" - name: "Greater_0" - op_type: "Greater" - } - node { - input: "onnx::Not_2" - output: "3" - name: "Not_1" - op_type: "Not" + input: "onnx::LessOrEqual_0" + input: "onnx::LessOrEqual_1" + output: "2" + name: "LessOrEqual_0" + op_type: "LessOrEqual" } name: "torch_jit" input { - name: "onnx::Greater_0" + name: "onnx::LessOrEqual_0" type { tensor_type { elem_type: 6 @@ -33,7 +27,7 @@ graph { } } input { - name: "onnx::Greater_1" + name: "onnx::LessOrEqual_1" type { tensor_type { elem_type: 6 @@ -49,7 +43,7 @@ graph { } } output { - name: "3" + name: "2" type { tensor_type { elem_type: 9 @@ -66,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_linear.expect b/test/onnx/expect/TestOperators.test_linear.expect index 372c34223baf..71c64dfe5a50 100644 --- a/test/onnx/expect/TestOperators.test_linear.expect +++ b/test/onnx/expect/TestOperators.test_linear.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -102,5 +102,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_log_sigmoid.expect b/test/onnx/expect/TestOperators.test_log_sigmoid.expect index 993490e9e1dd..2681f1193102 100644 --- a/test/onnx/expect/TestOperators.test_log_sigmoid.expect +++ b/test/onnx/expect/TestOperators.test_log_sigmoid.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -61,5 +61,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_logsoftmax.expect b/test/onnx/expect/TestOperators.test_logsoftmax.expect index d01223a4c579..1c4de89b6402 100644 --- a/test/onnx/expect/TestOperators.test_logsoftmax.expect +++ b/test/onnx/expect/TestOperators.test_logsoftmax.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -60,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_lt.expect b/test/onnx/expect/TestOperators.test_lt.expect index 57b6366e7b2a..2dbcc07cd9e1 100644 --- a/test/onnx/expect/TestOperators.test_lt.expect +++ b/test/onnx/expect/TestOperators.test_lt.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -72,5 +72,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_max.expect b/test/onnx/expect/TestOperators.test_max.expect index 295f32c6f87b..d9fcc0fb5f7a 100644 --- a/test/onnx/expect/TestOperators.test_max.expect +++ b/test/onnx/expect/TestOperators.test_max.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -60,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_maxpool.expect b/test/onnx/expect/TestOperators.test_maxpool.expect index 13dabcfd506e..f43712bbfc58 100644 --- a/test/onnx/expect/TestOperators.test_maxpool.expect +++ b/test/onnx/expect/TestOperators.test_maxpool.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -7,6 +7,11 @@ graph { output: "1" name: "MaxPool_0" op_type: "MaxPool" + attribute { + name: "ceil_mode" + i: 0 + type: INT + } attribute { name: "kernel_shape" ints: 3 @@ -65,5 +70,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_maxpool_indices.expect b/test/onnx/expect/TestOperators.test_maxpool_indices.expect index 249112abedfa..46c23e3a4cae 100644 --- a/test/onnx/expect/TestOperators.test_maxpool_indices.expect +++ b/test/onnx/expect/TestOperators.test_maxpool_indices.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -8,6 +8,11 @@ graph { output: "onnx::Sub_2" name: "MaxPool_0" op_type: "MaxPool" + attribute { + name: "ceil_mode" + i: 0 + type: INT + } attribute { name: "kernel_shape" ints: 3 @@ -43,31 +48,61 @@ graph { } } node { - input: "onnx::Slice_4" - output: "onnx::Sub_5" - name: "Slice_2" - op_type: "Slice" + output: "onnx::Slice_5" + name: "Constant_2" + op_type: "Constant" attribute { - name: "axes" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_6" + name: "Constant_3" + op_type: "Constant" attribute { - name: "ends" - ints: 1 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_7" + name: "Constant_4" + op_type: "Constant" attribute { - name: "starts" - ints: 0 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR } } + node { + input: "onnx::Slice_4" + input: "onnx::Slice_6" + input: "onnx::Slice_7" + input: "onnx::Slice_5" + output: "onnx::Sub_8" + name: "Slice_5" + op_type: "Slice" + } node { input: "onnx::Sub_2" - input: "onnx::Sub_5" - output: "6" - name: "Sub_3" + input: "onnx::Sub_8" + output: "9" + name: "Sub_6" op_type: "Sub" } name: "torch_jit" @@ -110,7 +145,7 @@ graph { } } output { - name: "6" + name: "9" type { tensor_type { elem_type: 7 @@ -130,5 +165,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_mean.expect b/test/onnx/expect/TestOperators.test_mean.expect index 8148bfdb54b3..b53b8c2f1248 100644 --- a/test/onnx/expect/TestOperators.test_mean.expect +++ b/test/onnx/expect/TestOperators.test_mean.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -48,5 +48,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_mean_dtype.expect b/test/onnx/expect/TestOperators.test_mean_dtype.expect index dfda5eba27e0..92ce0ae3aa99 100644 --- a/test/onnx/expect/TestOperators.test_mean_dtype.expect +++ b/test/onnx/expect/TestOperators.test_mean_dtype.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -59,5 +59,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_meshgrid.expect b/test/onnx/expect/TestOperators.test_meshgrid.expect index ba0edfb1c398..05b9de875d94 100644 --- a/test/onnx/expect/TestOperators.test_meshgrid.expect +++ b/test/onnx/expect/TestOperators.test_meshgrid.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -318,5 +318,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_min.expect b/test/onnx/expect/TestOperators.test_min.expect index 12945fa60e9f..28ca14779f71 100644 --- a/test/onnx/expect/TestOperators.test_min.expect +++ b/test/onnx/expect/TestOperators.test_min.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -60,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_mm.expect b/test/onnx/expect/TestOperators.test_mm.expect index 4b436e8ca249..9492d651fd9e 100644 --- a/test/onnx/expect/TestOperators.test_mm.expect +++ b/test/onnx/expect/TestOperators.test_mm.expect @@ -1,27 +1,12 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { - node { - output: "onnx::Gemm_2" - name: "Constant_0" - op_type: "Constant" - attribute { - name: "value" - t { - dims: 1 - data_type: 1 - raw_data: "\000\000\200?" - } - type: TENSOR - } - } node { input: "onnx::Gemm_0" input: "onnx::Gemm_1" - input: "onnx::Gemm_2" - output: "3" - name: "Gemm_1" + output: "2" + name: "Gemm_0" op_type: "Gemm" attribute { name: "alpha" @@ -68,7 +53,7 @@ graph { } } output { - name: "3" + name: "2" type { tensor_type { elem_type: 1 @@ -85,5 +70,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_narrow.expect b/test/onnx/expect/TestOperators.test_narrow.expect index 52e3e9c8ebff..a7b13c89a646 100644 --- a/test/onnx/expect/TestOperators.test_narrow.expect +++ b/test/onnx/expect/TestOperators.test_narrow.expect @@ -1,29 +1,35 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "onnx::Slice_0" - output: "1" + input: "onnx::Slice_14" + input: "onnx::Slice_15" + input: "onnx::Slice_16" + output: "12" name: "Slice_0" op_type: "Slice" - attribute { - name: "axes" - ints: 0 - type: INTS - } - attribute { - name: "ends" - ints: 2 - type: INTS - } - attribute { - name: "starts" - ints: 0 - type: INTS - } } name: "torch_jit" + initializer { + dims: 1 + data_type: 7 + name: "onnx::Slice_14" + raw_data: "\000\000\000\000\000\000\000\000" + } + initializer { + dims: 1 + data_type: 7 + name: "onnx::Slice_15" + raw_data: "\002\000\000\000\000\000\000\000" + } + initializer { + dims: 1 + data_type: 7 + name: "onnx::Slice_16" + raw_data: "\000\000\000\000\000\000\000\000" + } input { name: "onnx::Slice_0" type { @@ -41,7 +47,7 @@ graph { } } output { - name: "1" + name: "12" type { tensor_type { elem_type: 1 @@ -58,5 +64,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_ne.expect b/test/onnx/expect/TestOperators.test_ne.expect index 55d35128cb33..ab053fbcf67e 100644 --- a/test/onnx/expect/TestOperators.test_ne.expect +++ b/test/onnx/expect/TestOperators.test_ne.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -78,5 +78,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_nonzero.expect b/test/onnx/expect/TestOperators.test_nonzero.expect index 9090e3959742..cfcb1f505f87 100644 --- a/test/onnx/expect/TestOperators.test_nonzero.expect +++ b/test/onnx/expect/TestOperators.test_nonzero.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -58,5 +58,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_norm_p1.expect b/test/onnx/expect/TestOperators.test_norm_p1.expect index df15562f6072..ec5e12b90a16 100644 --- a/test/onnx/expect/TestOperators.test_norm_p1.expect +++ b/test/onnx/expect/TestOperators.test_norm_p1.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -62,5 +62,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_norm_p2.expect b/test/onnx/expect/TestOperators.test_norm_p2.expect index 1fadd7a7706f..0388ec620821 100644 --- a/test/onnx/expect/TestOperators.test_norm_p2.expect +++ b/test/onnx/expect/TestOperators.test_norm_p2.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -62,5 +62,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_ones_like.expect b/test/onnx/expect/TestOperators.test_ones_like.expect index 30e234cc935c..fafec789b174 100644 --- a/test/onnx/expect/TestOperators.test_ones_like.expect +++ b/test/onnx/expect/TestOperators.test_ones_like.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -36,5 +36,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_pad.expect b/test/onnx/expect/TestOperators.test_pad.expect index ab8125247058..0a25fb0eaf87 100644 --- a/test/onnx/expect/TestOperators.test_pad.expect +++ b/test/onnx/expect/TestOperators.test_pad.expect @@ -1,31 +1,190 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { + node { + input: "onnx::ConstantOfShape_27" + output: "onnx::Concat_10" + name: "ConstantOfShape_0" + op_type: "ConstantOfShape" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Concat_28" + input: "onnx::Concat_10" + output: "onnx::Reshape_11" + name: "Concat_1" + op_type: "Concat" + attribute { + name: "axis" + i: 0 + type: INT + } + } + node { + output: "onnx::Reshape_12" + name: "Constant_2" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 2 + data_type: 7 + raw_data: "\377\377\377\377\377\377\377\377\002\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Reshape_11" + input: "onnx::Reshape_12" + output: "onnx::Slice_13" + name: "Reshape_3" + op_type: "Reshape" + } + node { + output: "onnx::Slice_14" + name: "Constant_4" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + output: "onnx::Slice_15" + name: "Constant_5" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\377\377\377\377\377\377\377\377" + } + type: TENSOR + } + } + node { + output: "onnx::Slice_16" + name: "Constant_6" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\200" + } + type: TENSOR + } + } + node { + output: "onnx::Slice_17" + name: "Constant_7" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\377\377\377\377\377\377\377\377" + } + type: TENSOR + } + } + node { + input: "onnx::Slice_13" + input: "onnx::Slice_15" + input: "onnx::Slice_16" + input: "onnx::Slice_14" + input: "onnx::Slice_17" + output: "onnx::Transpose_18" + name: "Slice_8" + op_type: "Slice" + } + node { + input: "onnx::Transpose_18" + output: "onnx::Reshape_19" + name: "Transpose_9" + op_type: "Transpose" + attribute { + name: "perm" + ints: 1 + ints: 0 + type: INTS + } + } + node { + output: "onnx::Reshape_20" + name: "Constant_10" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\377\377\377\377\377\377\377\377" + } + type: TENSOR + } + } + node { + input: "onnx::Reshape_19" + input: "onnx::Reshape_20" + output: "onnx::Cast_21" + name: "Reshape_11" + op_type: "Reshape" + } + node { + input: "onnx::Cast_21" + output: "onnx::Pad_22" + name: "Cast_12" + op_type: "Cast" + attribute { + name: "to" + i: 7 + type: INT + } + } node { input: "input" - output: "1" - name: "Pad_0" + input: "onnx::Pad_22" + output: "23" + name: "Pad_13" op_type: "Pad" attribute { name: "mode" s: "reflect" type: STRING } - attribute { - name: "pads" - ints: 0 - ints: 0 - ints: 0 - ints: 2 - ints: 0 - ints: 0 - ints: 1 - ints: 3 - type: INTS - } } name: "torch_jit" + initializer { + dims: 1 + data_type: 7 + name: "onnx::ConstantOfShape_27" + raw_data: "\004\000\000\000\000\000\000\000" + } + initializer { + dims: 4 + data_type: 7 + name: "onnx::Concat_28" + raw_data: "\002\000\000\000\000\000\000\000\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000" + } input { name: "input" type { @@ -49,22 +208,22 @@ graph { } } output { - name: "1" + name: "23" type { tensor_type { elem_type: 1 shape { dim { - dim_value: 1 + dim_param: "Pad23_dim_0" } dim { - dim_value: 1 + dim_param: "Pad23_dim_1" } dim { - dim_value: 3 + dim_param: "Pad23_dim_2" } dim { - dim_value: 9 + dim_param: "Pad23_dim_3" } } } @@ -72,5 +231,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_params.expect b/test/onnx/expect/TestOperators.test_params.expect index 1d1bd7d4936e..67064d8087ae 100644 --- a/test/onnx/expect/TestOperators.test_params.expect +++ b/test/onnx/expect/TestOperators.test_params.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -92,5 +92,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_params_onnx_irv4.expect b/test/onnx/expect/TestOperators.test_params_onnx_irv4.expect index d6ddd543f354..8dbc34a20640 100644 --- a/test/onnx/expect/TestOperators.test_params_onnx_irv4.expect +++ b/test/onnx/expect/TestOperators.test_params_onnx_irv4.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -76,5 +76,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_permute2.expect b/test/onnx/expect/TestOperators.test_permute2.expect index 42310b833710..7f7b6afd9d2d 100644 --- a/test/onnx/expect/TestOperators.test_permute2.expect +++ b/test/onnx/expect/TestOperators.test_permute2.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -77,5 +77,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_pow.expect b/test/onnx/expect/TestOperators.test_pow.expect index 56dd281d9d2a..f20fd9555090 100644 --- a/test/onnx/expect/TestOperators.test_pow.expect +++ b/test/onnx/expect/TestOperators.test_pow.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -78,5 +78,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_prelu.expect b/test/onnx/expect/TestOperators.test_prelu.expect index f38134f579dd..f2bcb50ef777 100644 --- a/test/onnx/expect/TestOperators.test_prelu.expect +++ b/test/onnx/expect/TestOperators.test_prelu.expect @@ -1,11 +1,11 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "onnx::PRelu_0" - input: "onnx::PRelu_4" - output: "3" + input: "onnx::PRelu_5" + output: "4" name: "PRelu_0" op_type: "PRelu" } @@ -15,7 +15,7 @@ graph { dims: 1 dims: 1 data_type: 1 - name: "onnx::PRelu_4" + name: "onnx::PRelu_5" raw_data: "\000\000\200>\000\000\200>" } input { @@ -41,7 +41,7 @@ graph { } } input { - name: "onnx::PRelu_4" + name: "onnx::PRelu_5" type { tensor_type { elem_type: 1 @@ -60,7 +60,7 @@ graph { } } output { - name: "3" + name: "4" type { tensor_type { elem_type: 1 @@ -83,5 +83,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_prod.expect b/test/onnx/expect/TestOperators.test_prod.expect index 33b1f0e44f3e..0cfeafa4da32 100644 --- a/test/onnx/expect/TestOperators.test_prod.expect +++ b/test/onnx/expect/TestOperators.test_prod.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -48,5 +48,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_prod_dtype.expect b/test/onnx/expect/TestOperators.test_prod_dtype.expect index d9359ba40686..26a63ac840ad 100644 --- a/test/onnx/expect/TestOperators.test_prod_dtype.expect +++ b/test/onnx/expect/TestOperators.test_prod_dtype.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -59,5 +59,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_rand.expect b/test/onnx/expect/TestOperators.test_rand.expect index 02e239ba584d..b4d2dbd6cb19 100644 --- a/test/onnx/expect/TestOperators.test_rand.expect +++ b/test/onnx/expect/TestOperators.test_rand.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -69,5 +69,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_randn.expect b/test/onnx/expect/TestOperators.test_randn.expect index ef8c51827d89..bc2d0b23dd7b 100644 --- a/test/onnx/expect/TestOperators.test_randn.expect +++ b/test/onnx/expect/TestOperators.test_randn.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -69,5 +69,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduce_sum_negative_indices.expect b/test/onnx/expect/TestOperators.test_reduce_sum_negative_indices.expect index 044a4b47cdb8..7e5fefad2eb7 100644 --- a/test/onnx/expect/TestOperators.test_reduce_sum_negative_indices.expect +++ b/test/onnx/expect/TestOperators.test_reduce_sum_negative_indices.expect @@ -1,17 +1,27 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::ReduceSum_0" - output: "1" - name: "ReduceSum_0" - op_type: "ReduceSum" + output: "onnx::ReduceSum_1" + name: "Constant_0" + op_type: "Constant" attribute { - name: "axes" - ints: -1 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\377\377\377\377\377\377\377\377" + } + type: TENSOR } + } + node { + input: "onnx::ReduceSum_0" + input: "onnx::ReduceSum_1" + output: "2" + name: "ReduceSum_1" + op_type: "ReduceSum" attribute { name: "keepdims" i: 0 @@ -36,7 +46,7 @@ graph { } } output { - name: "1" + name: "2" type { tensor_type { elem_type: 1 @@ -50,5 +60,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_mean.expect b/test/onnx/expect/TestOperators.test_reduced_mean.expect index f5da3dc6d104..ce69ab65a6a6 100644 --- a/test/onnx/expect/TestOperators.test_reduced_mean.expect +++ b/test/onnx/expect/TestOperators.test_reduced_mean.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -62,5 +62,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_mean_dtype.expect b/test/onnx/expect/TestOperators.test_reduced_mean_dtype.expect index 231d847669e6..71d9d296aecd 100644 --- a/test/onnx/expect/TestOperators.test_reduced_mean_dtype.expect +++ b/test/onnx/expect/TestOperators.test_reduced_mean_dtype.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -73,5 +73,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_mean_keepdim.expect b/test/onnx/expect/TestOperators.test_reduced_mean_keepdim.expect index 3ab9b2629d3d..98bb26aaea36 100644 --- a/test/onnx/expect/TestOperators.test_reduced_mean_keepdim.expect +++ b/test/onnx/expect/TestOperators.test_reduced_mean_keepdim.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -66,5 +66,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_prod.expect b/test/onnx/expect/TestOperators.test_reduced_prod.expect index 2d281995da12..cdfbc0f5fbb6 100644 --- a/test/onnx/expect/TestOperators.test_reduced_prod.expect +++ b/test/onnx/expect/TestOperators.test_reduced_prod.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -62,5 +62,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_prod_dtype.expect b/test/onnx/expect/TestOperators.test_reduced_prod_dtype.expect index a6bcac89d3d0..641d21cb9c79 100644 --- a/test/onnx/expect/TestOperators.test_reduced_prod_dtype.expect +++ b/test/onnx/expect/TestOperators.test_reduced_prod_dtype.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -73,5 +73,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_prod_keepdim.expect b/test/onnx/expect/TestOperators.test_reduced_prod_keepdim.expect index edfe354880d3..62befc2cf1cf 100644 --- a/test/onnx/expect/TestOperators.test_reduced_prod_keepdim.expect +++ b/test/onnx/expect/TestOperators.test_reduced_prod_keepdim.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -65,5 +65,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_sum.expect b/test/onnx/expect/TestOperators.test_reduced_sum.expect index 69f8abdc48ee..e03a204a3f99 100644 --- a/test/onnx/expect/TestOperators.test_reduced_sum.expect +++ b/test/onnx/expect/TestOperators.test_reduced_sum.expect @@ -1,18 +1,27 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::ReduceSum_0" - output: "1" - name: "ReduceSum_0" - op_type: "ReduceSum" + output: "onnx::ReduceSum_1" + name: "Constant_0" + op_type: "Constant" attribute { - name: "axes" - ints: 1 - ints: 2 - type: INTS + name: "value" + t { + dims: 2 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + input: "onnx::ReduceSum_0" + input: "onnx::ReduceSum_1" + output: "2" + name: "ReduceSum_1" + op_type: "ReduceSum" attribute { name: "keepdims" i: 0 @@ -43,7 +52,7 @@ graph { } } output { - name: "1" + name: "2" type { tensor_type { elem_type: 1 @@ -60,5 +69,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_sum_dtype.expect b/test/onnx/expect/TestOperators.test_reduced_sum_dtype.expect index 59fdbf24d48e..e8ffa49295a5 100644 --- a/test/onnx/expect/TestOperators.test_reduced_sum_dtype.expect +++ b/test/onnx/expect/TestOperators.test_reduced_sum_dtype.expect @@ -1,11 +1,25 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::Cast_0" output: "onnx::ReduceSum_1" - name: "Cast_0" + name: "Constant_0" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + input: "onnx::Cast_0" + output: "onnx::ReduceSum_2" + name: "Cast_1" op_type: "Cast" attribute { name: "to" @@ -14,15 +28,11 @@ graph { } } node { + input: "onnx::ReduceSum_2" input: "onnx::ReduceSum_1" - output: "2" - name: "ReduceSum_1" + output: "3" + name: "ReduceSum_2" op_type: "ReduceSum" - attribute { - name: "axes" - ints: 0 - type: INTS - } attribute { name: "keepdims" i: 0 @@ -53,7 +63,7 @@ graph { } } output { - name: "2" + name: "3" type { tensor_type { elem_type: 11 @@ -73,5 +83,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reduced_sum_keepdim.expect b/test/onnx/expect/TestOperators.test_reduced_sum_keepdim.expect index 6c3498d89786..7d05fdc26041 100644 --- a/test/onnx/expect/TestOperators.test_reduced_sum_keepdim.expect +++ b/test/onnx/expect/TestOperators.test_reduced_sum_keepdim.expect @@ -1,17 +1,27 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::ReduceSum_0" - output: "1" - name: "ReduceSum_0" - op_type: "ReduceSum" + output: "onnx::ReduceSum_1" + name: "Constant_0" + op_type: "Constant" attribute { - name: "axes" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + input: "onnx::ReduceSum_0" + input: "onnx::ReduceSum_1" + output: "2" + name: "ReduceSum_1" + op_type: "ReduceSum" attribute { name: "keepdims" i: 1 @@ -42,7 +52,7 @@ graph { } } output { - name: "1" + name: "2" type { tensor_type { elem_type: 1 @@ -65,5 +75,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reducemax.expect b/test/onnx/expect/TestOperators.test_reducemax.expect index 015621e36cc3..bbd770761f3a 100644 --- a/test/onnx/expect/TestOperators.test_reducemax.expect +++ b/test/onnx/expect/TestOperators.test_reducemax.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -48,5 +48,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_reducemin.expect b/test/onnx/expect/TestOperators.test_reducemin.expect index ba713c955d53..a555fac90f0a 100644 --- a/test/onnx/expect/TestOperators.test_reducemin.expect +++ b/test/onnx/expect/TestOperators.test_reducemin.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -48,5 +48,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_remainder.expect b/test/onnx/expect/TestOperators.test_remainder.expect index 75799ad14ec6..ecf44141260e 100644 --- a/test/onnx/expect/TestOperators.test_remainder.expect +++ b/test/onnx/expect/TestOperators.test_remainder.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -89,5 +89,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_repeat.expect b/test/onnx/expect/TestOperators.test_repeat.expect index e87fce2e4792..5206bce0d88f 100644 --- a/test/onnx/expect/TestOperators.test_repeat.expect +++ b/test/onnx/expect/TestOperators.test_repeat.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -98,5 +98,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_repeat_dim_overflow.expect b/test/onnx/expect/TestOperators.test_repeat_dim_overflow.expect index fb0730a99e55..2dbb3a436d42 100644 --- a/test/onnx/expect/TestOperators.test_repeat_dim_overflow.expect +++ b/test/onnx/expect/TestOperators.test_repeat_dim_overflow.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -92,5 +92,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_rrelu.expect b/test/onnx/expect/TestOperators.test_rrelu.expect index 959a842d29b8..3fb75ab0bb4a 100644 --- a/test/onnx/expect/TestOperators.test_rrelu.expect +++ b/test/onnx/expect/TestOperators.test_rrelu.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -72,5 +72,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_rsqrt.expect b/test/onnx/expect/TestOperators.test_rsqrt.expect index 3f0b2f654fc2..32e4df543ae9 100644 --- a/test/onnx/expect/TestOperators.test_rsqrt.expect +++ b/test/onnx/expect/TestOperators.test_rsqrt.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -63,5 +63,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_rsub.expect b/test/onnx/expect/TestOperators.test_rsub.expect index fcc5e3e46f92..75344bfc68de 100644 --- a/test/onnx/expect/TestOperators.test_rsub.expect +++ b/test/onnx/expect/TestOperators.test_rsub.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -57,5 +57,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_scatter_add.expect b/test/onnx/expect/TestOperators.test_scatter_add.expect index 7e5604971ec6..fd7514e30630 100644 --- a/test/onnx/expect/TestOperators.test_scatter_add.expect +++ b/test/onnx/expect/TestOperators.test_scatter_add.expect @@ -1,9 +1,9 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - output: "onnx::Scatter_3" + output: "onnx::ScatterElements_3" name: "Constant_0" op_type: "Constant" attribute { @@ -18,12 +18,12 @@ graph { } } node { - input: "onnx::Scatter_3" - input: "onnx::Scatter_1" - input: "onnx::Scatter_2" + input: "onnx::ScatterElements_3" + input: "onnx::ScatterElements_1" + input: "onnx::ScatterElements_2" output: "onnx::Add_4" - name: "Scatter_1" - op_type: "Scatter" + name: "ScatterElements_1" + op_type: "ScatterElements" attribute { name: "axis" i: 1 @@ -55,7 +55,7 @@ graph { } } input { - name: "onnx::Scatter_1" + name: "onnx::ScatterElements_1" type { tensor_type { elem_type: 7 @@ -71,7 +71,7 @@ graph { } } input { - name: "onnx::Scatter_2" + name: "onnx::ScatterElements_2" type { tensor_type { elem_type: 1 @@ -104,5 +104,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_selu.expect b/test/onnx/expect/TestOperators.test_selu.expect index 9469c9432c80..7cdc4dc8bac4 100644 --- a/test/onnx/expect/TestOperators.test_selu.expect +++ b/test/onnx/expect/TestOperators.test_selu.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -55,5 +55,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_shape_value_map.expect b/test/onnx/expect/TestOperators.test_shape_value_map.expect index c0044e4f4ceb..174551f9a7c5 100644 --- a/test/onnx/expect/TestOperators.test_shape_value_map.expect +++ b/test/onnx/expect/TestOperators.test_shape_value_map.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -34,23 +34,33 @@ graph { } } node { - input: "onnx::Unsqueeze_3" - output: "onnx::Concat_7" - name: "Unsqueeze_3" - op_type: "Unsqueeze" + output: "onnx::Unsqueeze_7" + name: "Constant_3" + op_type: "Constant" attribute { - name: "axes" - ints: 0 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } } node { - input: "onnx::Concat_7" - input: "onnx::Concat_21" - input: "onnx::Concat_22" - input: "onnx::Concat_23" - output: "onnx::Reshape_11" - name: "Concat_4" + input: "onnx::Unsqueeze_3" + input: "onnx::Unsqueeze_7" + output: "onnx::Concat_8" + name: "Unsqueeze_4" + op_type: "Unsqueeze" + } + node { + input: "onnx::Concat_8" + input: "onnx::Concat_26" + input: "onnx::Concat_27" + input: "onnx::Concat_28" + output: "onnx::Reshape_15" + name: "Concat_5" op_type: "Concat" attribute { name: "axis" @@ -60,66 +70,62 @@ graph { } node { input: "x" - input: "onnx::Reshape_11" - output: "onnx::Transpose_12" - name: "Reshape_5" + input: "onnx::Reshape_15" + output: "onnx::Transpose_16" + name: "Reshape_6" op_type: "Reshape" } node { - input: "onnx::Transpose_12" - output: "onnx::Softmax_13" - name: "Transpose_6" + input: "onnx::Transpose_16" + output: "x.1" + name: "Transpose_7" op_type: "Transpose" attribute { name: "perm" ints: 0 - ints: 3 - ints: 1 ints: 2 + ints: 1 + ints: 3 type: INTS } } node { - input: "onnx::Softmax_13" - output: "onnx::Transpose_14" - name: "Softmax_7" + input: "x.1" + output: "onnx::Reshape_18" + name: "Softmax_8" op_type: "Softmax" attribute { name: "axis" - i: 3 + i: 1 type: INT } } node { - input: "onnx::Transpose_14" - output: "onnx::Reshape_15" - name: "Transpose_8" - op_type: "Transpose" + output: "onnx::Unsqueeze_20" + name: "Constant_9" + op_type: "Constant" attribute { - name: "perm" - ints: 0 - ints: 3 - ints: 2 - ints: 1 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } } node { input: "onnx::Unsqueeze_3" - output: "onnx::Concat_17" - name: "Unsqueeze_9" + input: "onnx::Unsqueeze_20" + output: "onnx::Concat_21" + name: "Unsqueeze_10" op_type: "Unsqueeze" - attribute { - name: "axes" - ints: 0 - type: INTS - } } node { - input: "onnx::Concat_17" - input: "onnx::Concat_24" - output: "onnx::Reshape_19" - name: "Concat_10" + input: "onnx::Concat_21" + input: "onnx::Concat_29" + output: "onnx::Reshape_24" + name: "Concat_11" op_type: "Concat" attribute { name: "axis" @@ -128,35 +134,35 @@ graph { } } node { - input: "onnx::Reshape_15" - input: "onnx::Reshape_19" - output: "20" - name: "Reshape_11" + input: "onnx::Reshape_18" + input: "onnx::Reshape_24" + output: "25" + name: "Reshape_12" op_type: "Reshape" } name: "torch_jit" initializer { dims: 1 data_type: 7 - name: "onnx::Concat_21" + name: "onnx::Concat_26" raw_data: "\001\000\000\000\000\000\000\000" } initializer { dims: 1 data_type: 7 - name: "onnx::Concat_22" + name: "onnx::Concat_27" raw_data: "\002\000\000\000\000\000\000\000" } initializer { dims: 1 data_type: 7 - name: "onnx::Concat_23" + name: "onnx::Concat_28" raw_data: "\377\377\377\377\377\377\377\377" } initializer { dims: 1 data_type: 7 - name: "onnx::Concat_24" + name: "onnx::Concat_29" raw_data: "\377\377\377\377\377\377\377\377" } input { @@ -182,7 +188,7 @@ graph { } } output { - name: "20" + name: "25" type { tensor_type { elem_type: 1 @@ -199,5 +205,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_sign.expect b/test/onnx/expect/TestOperators.test_sign.expect index 0cf0a0fa4417..6cb9200dc073 100644 --- a/test/onnx/expect/TestOperators.test_sign.expect +++ b/test/onnx/expect/TestOperators.test_sign.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_sin.expect b/test/onnx/expect/TestOperators.test_sin.expect index 2e5710f70d43..4ca6284c48d9 100644 --- a/test/onnx/expect/TestOperators.test_sin.expect +++ b/test/onnx/expect/TestOperators.test_sin.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_slice.expect b/test/onnx/expect/TestOperators.test_slice.expect index 755625522ace..15aa37bc2f7e 100644 --- a/test/onnx/expect/TestOperators.test_slice.expect +++ b/test/onnx/expect/TestOperators.test_slice.expect @@ -1,28 +1,73 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::Slice_0" - output: "1" - name: "Slice_0" - op_type: "Slice" + output: "onnx::Slice_1" + name: "Constant_0" + op_type: "Constant" attribute { - name: "axes" - ints: 1 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_2" + name: "Constant_1" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + output: "onnx::Slice_3" + name: "Constant_2" + op_type: "Constant" attribute { - name: "ends" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_4" + name: "Constant_3" + op_type: "Constant" attribute { - name: "starts" - ints: 1 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\001\000\000\000\000\000\000\000" + } + type: TENSOR } } + node { + input: "onnx::Slice_0" + input: "onnx::Slice_2" + input: "onnx::Slice_3" + input: "onnx::Slice_1" + input: "onnx::Slice_4" + output: "5" + name: "Slice_4" + op_type: "Slice" + } name: "torch_jit" input { name: "onnx::Slice_0" @@ -41,7 +86,7 @@ graph { } } output { - name: "1" + name: "5" type { tensor_type { elem_type: 1 @@ -58,5 +103,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_split.expect b/test/onnx/expect/TestOperators.test_split.expect index bd11058b1a5e..e1616e4a52cd 100644 --- a/test/onnx/expect/TestOperators.test_split.expect +++ b/test/onnx/expect/TestOperators.test_split.expect @@ -1,26 +1,34 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { + node { + output: "onnx::Split_1" + name: "Constant_0" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 3 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000" + } + type: TENSOR + } + } node { input: "tensor" - output: "1" + input: "onnx::Split_1" output: "2" output: "3" - name: "Split_0" + output: "4" + name: "Split_1" op_type: "Split" attribute { name: "axis" i: 1 type: INT } - attribute { - name: "split" - ints: 2 - ints: 2 - ints: 2 - type: INTS - } } name: "torch_jit" input { @@ -40,7 +48,7 @@ graph { } } output { - name: "1" + name: "2" type { tensor_type { elem_type: 1 @@ -56,7 +64,7 @@ graph { } } output { - name: "2" + name: "3" type { tensor_type { elem_type: 1 @@ -72,7 +80,7 @@ graph { } } output { - name: "3" + name: "4" type { tensor_type { elem_type: 1 @@ -89,5 +97,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_split_with_sizes.expect b/test/onnx/expect/TestOperators.test_split_with_sizes.expect index 359135cdb01a..964ba363a56e 100644 --- a/test/onnx/expect/TestOperators.test_split_with_sizes.expect +++ b/test/onnx/expect/TestOperators.test_split_with_sizes.expect @@ -1,26 +1,34 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { + node { + output: "onnx::Split_1" + name: "Constant_0" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 3 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\003\000\000\000\000\000\000\000" + } + type: TENSOR + } + } node { input: "tensor" - output: "1" + input: "onnx::Split_1" output: "2" output: "3" - name: "Split_0" + output: "4" + name: "Split_1" op_type: "Split" attribute { name: "axis" i: 1 type: INT } - attribute { - name: "split" - ints: 2 - ints: 1 - ints: 3 - type: INTS - } } name: "torch_jit" input { @@ -40,7 +48,7 @@ graph { } } output { - name: "1" + name: "2" type { tensor_type { elem_type: 1 @@ -56,7 +64,7 @@ graph { } } output { - name: "2" + name: "3" type { tensor_type { elem_type: 1 @@ -72,7 +80,7 @@ graph { } } output { - name: "3" + name: "4" type { tensor_type { elem_type: 1 @@ -89,5 +97,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_sqrt.expect b/test/onnx/expect/TestOperators.test_sqrt.expect index 67e86c2836dd..91fc7bac0b77 100644 --- a/test/onnx/expect/TestOperators.test_sqrt.expect +++ b/test/onnx/expect/TestOperators.test_sqrt.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_std.expect b/test/onnx/expect/TestOperators.test_std.expect index 957ac1937fb2..69df37b90452 100644 --- a/test/onnx/expect/TestOperators.test_std.expect +++ b/test/onnx/expect/TestOperators.test_std.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -185,5 +185,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_sum.expect b/test/onnx/expect/TestOperators.test_sum.expect index d923dab06db2..6722064ace20 100644 --- a/test/onnx/expect/TestOperators.test_sum.expect +++ b/test/onnx/expect/TestOperators.test_sum.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -48,5 +48,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_sum_dtype.expect b/test/onnx/expect/TestOperators.test_sum_dtype.expect index 3457c4d7e88b..2b5f417b0eee 100644 --- a/test/onnx/expect/TestOperators.test_sum_dtype.expect +++ b/test/onnx/expect/TestOperators.test_sum_dtype.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -59,5 +59,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_tan.expect b/test/onnx/expect/TestOperators.test_tan.expect index 1ff7b8ee19a0..84bc3e9420df 100644 --- a/test/onnx/expect/TestOperators.test_tan.expect +++ b/test/onnx/expect/TestOperators.test_tan.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_transpose.expect b/test/onnx/expect/TestOperators.test_transpose.expect index 41227d0b934a..f1350a1b2623 100644 --- a/test/onnx/expect/TestOperators.test_transpose.expect +++ b/test/onnx/expect/TestOperators.test_transpose.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -43,5 +43,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_type_as.expect b/test/onnx/expect/TestOperators.test_type_as.expect index 2af30c6ebc31..31803483edbd 100644 --- a/test/onnx/expect/TestOperators.test_type_as.expect +++ b/test/onnx/expect/TestOperators.test_type_as.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -37,5 +37,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_unfold.expect b/test/onnx/expect/TestOperators.test_unfold.expect index 58675ad825e7..9b5e20281d20 100644 --- a/test/onnx/expect/TestOperators.test_unfold.expect +++ b/test/onnx/expect/TestOperators.test_unfold.expect @@ -1,76 +1,156 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::Slice_0" - output: "onnx::Unsqueeze_1" - name: "Slice_0" - op_type: "Slice" + output: "onnx::Slice_1" + name: "Constant_0" + op_type: "Constant" attribute { - name: "axes" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_2" + name: "Constant_1" + op_type: "Constant" attribute { - name: "ends" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_3" + name: "Constant_2" + op_type: "Constant" attribute { - name: "starts" - ints: 0 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } } node { input: "onnx::Slice_0" - output: "onnx::Unsqueeze_2" - name: "Slice_1" + input: "onnx::Slice_2" + input: "onnx::Slice_3" + input: "onnx::Slice_1" + output: "onnx::Unsqueeze_4" + name: "Slice_3" op_type: "Slice" + } + node { + output: "onnx::Slice_5" + name: "Constant_4" + op_type: "Constant" attribute { - name: "axes" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_6" + name: "Constant_5" + op_type: "Constant" attribute { - name: "ends" - ints: 4 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } + } + node { + output: "onnx::Slice_7" + name: "Constant_6" + op_type: "Constant" attribute { - name: "starts" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\004\000\000\000\000\000\000\000" + } + type: TENSOR } } node { - input: "onnx::Unsqueeze_1" - output: "onnx::Concat_3" - name: "Unsqueeze_2" - op_type: "Unsqueeze" + input: "onnx::Slice_0" + input: "onnx::Slice_6" + input: "onnx::Slice_7" + input: "onnx::Slice_5" + output: "onnx::Unsqueeze_8" + name: "Slice_7" + op_type: "Slice" + } + node { + output: "onnx::Unsqueeze_9" + name: "Constant_8" + op_type: "Constant" attribute { - name: "axes" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } } node { - input: "onnx::Unsqueeze_2" - output: "onnx::Concat_4" - name: "Unsqueeze_3" + input: "onnx::Unsqueeze_4" + input: "onnx::Unsqueeze_9" + output: "onnx::Concat_10" + name: "Unsqueeze_9" op_type: "Unsqueeze" + } + node { + output: "onnx::Unsqueeze_11" + name: "Constant_10" + op_type: "Constant" attribute { - name: "axes" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } } node { - input: "onnx::Concat_3" - input: "onnx::Concat_4" - output: "5" - name: "Concat_4" + input: "onnx::Unsqueeze_8" + input: "onnx::Unsqueeze_11" + output: "onnx::Concat_12" + name: "Unsqueeze_11" + op_type: "Unsqueeze" + } + node { + input: "onnx::Concat_10" + input: "onnx::Concat_12" + output: "13" + name: "Concat_12" op_type: "Concat" attribute { name: "axis" @@ -99,7 +179,7 @@ graph { } } output { - name: "5" + name: "13" type { tensor_type { elem_type: 1 @@ -122,5 +202,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_unsqueeze.expect b/test/onnx/expect/TestOperators.test_unsqueeze.expect index 215b76683f3f..49a61c2b8451 100644 --- a/test/onnx/expect/TestOperators.test_unsqueeze.expect +++ b/test/onnx/expect/TestOperators.test_unsqueeze.expect @@ -1,18 +1,28 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - input: "onnx::Unsqueeze_0" - output: "1" - name: "Unsqueeze_0" - op_type: "Unsqueeze" + output: "onnx::Unsqueeze_1" + name: "Constant_0" + op_type: "Constant" attribute { - name: "axes" - ints: 2 - type: INTS + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" + } + type: TENSOR } } + node { + input: "onnx::Unsqueeze_0" + input: "onnx::Unsqueeze_1" + output: "2" + name: "Unsqueeze_1" + op_type: "Unsqueeze" + } name: "torch_jit" input { name: "onnx::Unsqueeze_0" @@ -31,7 +41,7 @@ graph { } } output { - name: "1" + name: "2" type { tensor_type { elem_type: 1 @@ -51,5 +61,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_upsample_nearest_scale.expect b/test/onnx/expect/TestOperators.test_upsample_nearest_scale.expect index a05dc8231686..e1f31dc406a0 100644 --- a/test/onnx/expect/TestOperators.test_upsample_nearest_scale.expect +++ b/test/onnx/expect/TestOperators.test_upsample_nearest_scale.expect @@ -1,24 +1,40 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "x" - input: "onnx::Upsample_5" - output: "4" - name: "Upsample_0" - op_type: "Upsample" + input: "" + input: "onnx::Resize_6" + output: "5" + name: "Resize_0" + op_type: "Resize" + attribute { + name: "coordinate_transformation_mode" + s: "asymmetric" + type: STRING + } + attribute { + name: "cubic_coeff_a" + f: -0.75 + type: FLOAT + } attribute { name: "mode" s: "nearest" type: STRING } + attribute { + name: "nearest_mode" + s: "floor" + type: STRING + } } name: "torch_jit" initializer { dims: 4 data_type: 1 - name: "onnx::Upsample_5" + name: "onnx::Resize_6" raw_data: "\000\000\200?\000\000\200?\000\000\000@\000\000\000@" } input { @@ -44,22 +60,22 @@ graph { } } output { - name: "4" + name: "5" type { tensor_type { elem_type: 1 shape { dim { - dim_value: 1 + dim_param: "Resize5_dim_0" } dim { - dim_value: 2 + dim_param: "Resize5_dim_1" } dim { - dim_value: 6 + dim_param: "Resize5_dim_2" } dim { - dim_value: 8 + dim_param: "Resize5_dim_3" } } } @@ -67,5 +83,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_upsample_nearest_scale_default_scale_factor.expect b/test/onnx/expect/TestOperators.test_upsample_nearest_scale_default_scale_factor.expect index a05dc8231686..e1f31dc406a0 100644 --- a/test/onnx/expect/TestOperators.test_upsample_nearest_scale_default_scale_factor.expect +++ b/test/onnx/expect/TestOperators.test_upsample_nearest_scale_default_scale_factor.expect @@ -1,24 +1,40 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "x" - input: "onnx::Upsample_5" - output: "4" - name: "Upsample_0" - op_type: "Upsample" + input: "" + input: "onnx::Resize_6" + output: "5" + name: "Resize_0" + op_type: "Resize" + attribute { + name: "coordinate_transformation_mode" + s: "asymmetric" + type: STRING + } + attribute { + name: "cubic_coeff_a" + f: -0.75 + type: FLOAT + } attribute { name: "mode" s: "nearest" type: STRING } + attribute { + name: "nearest_mode" + s: "floor" + type: STRING + } } name: "torch_jit" initializer { dims: 4 data_type: 1 - name: "onnx::Upsample_5" + name: "onnx::Resize_6" raw_data: "\000\000\200?\000\000\200?\000\000\000@\000\000\000@" } input { @@ -44,22 +60,22 @@ graph { } } output { - name: "4" + name: "5" type { tensor_type { elem_type: 1 shape { dim { - dim_value: 1 + dim_param: "Resize5_dim_0" } dim { - dim_value: 2 + dim_param: "Resize5_dim_1" } dim { - dim_value: 6 + dim_param: "Resize5_dim_2" } dim { - dim_value: 8 + dim_param: "Resize5_dim_3" } } } @@ -67,5 +83,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_upsample_nearest_size.expect b/test/onnx/expect/TestOperators.test_upsample_nearest_size.expect index e597ddfa5c5d..cbd32608d2ae 100644 --- a/test/onnx/expect/TestOperators.test_upsample_nearest_size.expect +++ b/test/onnx/expect/TestOperators.test_upsample_nearest_size.expect @@ -1,34 +1,112 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { - output: "onnx::Upsample_1" - name: "Constant_0" + input: "x" + output: "onnx::Slice_2" + name: "Shape_0" + op_type: "Shape" + } + node { + output: "onnx::Slice_3" + name: "Constant_1" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + output: "onnx::Slice_4" + name: "Constant_2" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + raw_data: "\000\000\000\000\000\000\000\000" + } + type: TENSOR + } + } + node { + output: "onnx::Slice_5" + name: "Constant_3" op_type: "Constant" attribute { name: "value" t { - dims: 4 - data_type: 1 - raw_data: "\000\000\200?\000\000\200?\253\252\252@\000\000\200@" + dims: 1 + data_type: 7 + raw_data: "\002\000\000\000\000\000\000\000" } type: TENSOR } } + node { + input: "onnx::Slice_2" + input: "onnx::Slice_4" + input: "onnx::Slice_5" + input: "onnx::Slice_3" + output: "onnx::Concat_6" + name: "Slice_4" + op_type: "Slice" + } + node { + input: "onnx::Concat_6" + input: "onnx::Concat_12" + output: "onnx::Resize_8" + name: "Concat_5" + op_type: "Concat" + attribute { + name: "axis" + i: 0 + type: INT + } + } node { input: "x" - input: "onnx::Upsample_1" - output: "2" - name: "Upsample_1" - op_type: "Upsample" + input: "" + input: "" + input: "onnx::Resize_8" + output: "11" + name: "Resize_6" + op_type: "Resize" + attribute { + name: "coordinate_transformation_mode" + s: "asymmetric" + type: STRING + } + attribute { + name: "cubic_coeff_a" + f: -0.75 + type: FLOAT + } attribute { name: "mode" s: "nearest" type: STRING } + attribute { + name: "nearest_mode" + s: "floor" + type: STRING + } } name: "torch_jit" + initializer { + dims: 2 + data_type: 7 + name: "onnx::Concat_12" + raw_data: "\020\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000" + } input { name: "x" type { @@ -52,22 +130,22 @@ graph { } } output { - name: "2" + name: "11" type { tensor_type { elem_type: 1 shape { dim { - dim_value: 1 + dim_param: "Resize11_dim_0" } dim { - dim_value: 2 + dim_param: "Resize11_dim_1" } dim { - dim_value: 16 + dim_param: "Resize11_dim_2" } dim { - dim_value: 16 + dim_param: "Resize11_dim_3" } } } @@ -75,5 +153,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_view.expect b/test/onnx/expect/TestOperators.test_view.expect index cb79b4181222..097625822969 100644 --- a/test/onnx/expect/TestOperators.test_view.expect +++ b/test/onnx/expect/TestOperators.test_view.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -55,5 +55,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_view_flatten.expect b/test/onnx/expect/TestOperators.test_view_flatten.expect index ae9d957dd9fd..ac814160d5bd 100644 --- a/test/onnx/expect/TestOperators.test_view_flatten.expect +++ b/test/onnx/expect/TestOperators.test_view_flatten.expect @@ -1,11 +1,11 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { node { input: "onnx::Reshape_0" - input: "onnx::Reshape_9" - output: "6" + input: "onnx::Reshape_11" + output: "8" name: "Reshape_0" op_type: "Reshape" } @@ -13,7 +13,7 @@ graph { initializer { dims: 2 data_type: 7 - name: "onnx::Reshape_9" + name: "onnx::Reshape_11" raw_data: "\001\000\000\000\000\000\000\000\030\000\000\000\000\000\000\000" } input { @@ -39,7 +39,7 @@ graph { } } output { - name: "6" + name: "8" type { tensor_type { elem_type: 1 @@ -56,5 +56,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/expect/TestOperators.test_zeros_like.expect b/test/onnx/expect/TestOperators.test_zeros_like.expect index 1293acb1e16f..e4f6c6ede2ca 100644 --- a/test/onnx/expect/TestOperators.test_zeros_like.expect +++ b/test/onnx/expect/TestOperators.test_zeros_like.expect @@ -1,4 +1,4 @@ -ir_version: 4 +ir_version: 7 producer_name: "pytorch" producer_version: "CURRENT_VERSION" graph { @@ -36,5 +36,5 @@ graph { } } opset_import { - version: 9 + version: 13 } diff --git a/test/onnx/test_models.py b/test/onnx/test_models.py index e8fad941026a..1f2e0258edc1 100644 --- a/test/onnx/test_models.py +++ b/test/onnx/test_models.py @@ -46,15 +46,15 @@ def toC(x): class TestModels(TestCase): + opset_version = 9 # Caffe2 doesn't support the default. keep_initializers_as_inputs = False - from torch.onnx.symbolic_helper import _export_onnx_opset_version - opset_version = _export_onnx_opset_version def exportTest(self, model, inputs, rtol=1e-2, atol=1e-7): with torch.onnx.select_model_mode_for_export(model, None): graph = torch.onnx.utils._trace(model, inputs, OperatorExportTypes.ONNX) torch._C._jit_pass_lint(graph) - verify(model, inputs, backend, rtol=rtol, atol=atol) + verify(model, inputs, backend, rtol=rtol, atol=atol, + opset_version=self.opset_version) def test_ops(self): x = Variable( diff --git a/test/onnx/test_pytorch_common.py b/test/onnx/test_pytorch_common.py index 13b4585a5def..35a408eca244 100644 --- a/test/onnx/test_pytorch_common.py +++ b/test/onnx/test_pytorch_common.py @@ -50,17 +50,17 @@ def skipIfUnsupportedMinOpsetVersion(min_opset_version): def skip_dec(func): def wrapper(self): if self.opset_version < min_opset_version: - raise unittest.SkipTest("Skip verify test for unsupported opset_version") + raise unittest.SkipTest(f"Unsupported opset_version: {self.opset_version} < {min_opset_version}") return func(self) return wrapper return skip_dec -# skips tests for all versions above min_opset_version. -def skipIfUnsupportedMaxOpsetVersion(min_opset_version): +# skips tests for all versions above max_opset_version. +def skipIfUnsupportedMaxOpsetVersion(max_opset_version): def skip_dec(func): def wrapper(self): - if self.opset_version > min_opset_version: - raise unittest.SkipTest("Skip verify test for unsupported opset_version") + if self.opset_version > max_opset_version: + raise unittest.SkipTest(f"Unsupported opset_version: {self.opset_version} > {max_opset_version}") return func(self) return wrapper return skip_dec @@ -107,14 +107,5 @@ def wrapper(self): return wrapper return skip_dec -def skipIfONNXShapeInference(onnx_shape_inference): - def skip_dec(func): - def wrapper(self): - if self.onnx_shape_inference is onnx_shape_inference: - raise unittest.SkipTest("Skip verify test for unsupported opset_version") - return func(self) - return wrapper - return skip_dec - def flatten(x): return tuple(function._iter_filter(lambda o: isinstance(o, torch.Tensor))(x)) diff --git a/test/onnx/test_pytorch_onnx_caffe2.py b/test/onnx/test_pytorch_onnx_caffe2.py index 72ff93922545..31c2287893a2 100644 --- a/test/onnx/test_pytorch_onnx_caffe2.py +++ b/test/onnx/test_pytorch_onnx_caffe2.py @@ -117,8 +117,7 @@ def do_export(model, inputs, *args, **kwargs): class TestCaffe2Backend_opset9(unittest.TestCase): - from torch.onnx.symbolic_helper import _export_onnx_opset_version - opset_version = _export_onnx_opset_version + opset_version = 9 embed_params = False def setUp(self): diff --git a/test/onnx/test_pytorch_onnx_caffe2_quantized.py b/test/onnx/test_pytorch_onnx_caffe2_quantized.py index b427b85a2b56..bb84ab698a9d 100644 --- a/test/onnx/test_pytorch_onnx_caffe2_quantized.py +++ b/test/onnx/test_pytorch_onnx_caffe2_quantized.py @@ -31,7 +31,9 @@ def generic_test(self, model, sample_inputs, input_names=None, decimal=3, relaxe f = io.BytesIO() torch.onnx.export(q_model, pt_inputs, f, input_names=input_names, - operator_export_type=torch.onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK) + operator_export_type=torch.onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK, + # Caffe2 doesn't support newer opset versions + opset_version=9) f.seek(0) onnx_model = onnx.load(f) caffe_res = c2.run_model(onnx_model, dict(zip(input_names, sample_inputs)))[0] @@ -94,7 +96,9 @@ def export_to_onnx(self, model, input, input_names): model = torch.jit.load(buf) f = io.BytesIO() torch.onnx.export(model, input, f, input_names=input_names, - operator_export_type=torch.onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK) + operator_export_type=torch.onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK, + # Caffe2 doesn't support newer opset versions + opset_version=9) f.seek(0) onnx_model = onnx.load(f) diff --git a/test/onnx/test_pytorch_onnx_onnxruntime.py b/test/onnx/test_pytorch_onnx_onnxruntime.py index 19aa58b17237..228e490e92d0 100644 --- a/test/onnx/test_pytorch_onnx_onnxruntime.py +++ b/test/onnx/test_pytorch_onnx_onnxruntime.py @@ -23,8 +23,7 @@ RnnModelWithPackedSequenceWithState, RnnModelWithPackedSequenceWithoutState) from test_pytorch_common import (skipIfUnsupportedMinOpsetVersion, skipIfUnsupportedOpsetVersion, - skipIfNoLapack, disableScriptTest, skipIfONNXShapeInference, - skipIfUnsupportedMaxOpsetVersion) + skipIfNoLapack, disableScriptTest, skipIfUnsupportedMaxOpsetVersion) from test_pytorch_common import BATCH_SIZE from test_pytorch_common import RNN_BATCH_SIZE, RNN_SEQUENCE_LENGTH, RNN_INPUT_SIZE, RNN_HIDDEN_SIZE from typing import List, Tuple, Optional, Dict @@ -82,9 +81,7 @@ def to_numpy(elem): def convert_to_onnx(model, input=None, opset_version=9, do_constant_folding=True, keep_initializers_as_inputs=True, dynamic_axes=None, input_names=None, output_names=None, - fixed_batch_size=False, training=None, - onnx_shape_inference=True): - # export the model to ONNX + fixed_batch_size=False, training=None): f = io.BytesIO() input_copy = copy.deepcopy(input) torch.onnx._export(model, input_copy, f, @@ -93,8 +90,7 @@ def convert_to_onnx(model, input=None, opset_version=9, do_constant_folding=True keep_initializers_as_inputs=keep_initializers_as_inputs, dynamic_axes=dynamic_axes, input_names=input_names, output_names=output_names, - fixed_batch_size=fixed_batch_size, training=training, - onnx_shape_inference=onnx_shape_inference) + fixed_batch_size=fixed_batch_size, training=training) # compute onnxruntime output prediction so = onnxruntime.SessionOptions() @@ -177,8 +173,7 @@ def run_model_test(self, model, batch_size=2, state_dict=None, do_constant_folding=do_constant_folding, keep_initializers_as_inputs=self.keep_initializers_as_inputs, dynamic_axes=dynamic_axes, input_names=input_names, - output_names=output_names, fixed_batch_size=fixed_batch_size, training=training, - onnx_shape_inference=self.onnx_shape_inference) + output_names=output_names, fixed_batch_size=fixed_batch_size, training=training) # compute onnxruntime output prediction if remained_onnx_input_idx is not None: input_onnx = [] @@ -289,11 +284,15 @@ def set_rng_seed(seed): random.seed(seed) np.random.seed(seed) -class TestONNXRuntime(unittest.TestCase): - from torch.onnx.symbolic_helper import _export_onnx_opset_version - opset_version = _export_onnx_opset_version +class _TestONNXRuntime: + """Abstract base class for test cases. + + Intentionally not a sub-class of unittest.TestCase so that unittest / pytest + don't run it directly. unitest.TestCase is mixed in as another base class when + creating concrete sub-types. See MakeTestCase(). + """ + opset_version = -1 # Sub-classes must override keep_initializers_as_inputs = True # For IR version 3 type export. - onnx_shape_inference = True def setUp(self): torch.manual_seed(0) @@ -1436,7 +1435,6 @@ def forward(self, input1, input2, input3): # Conversion of Transpose depends on input shape to be known. # The following test only works when onnx shape inference is enabled. - @skipIfONNXShapeInference(False) def test_transpose_infer_shape(self): class TransposeModule(torch.jit.ScriptModule): def __init__(self): @@ -1664,7 +1662,6 @@ def forward(self, x): # Operator rank mismatch between outputs of two branches for opsets below 11. @skipIfUnsupportedMinOpsetVersion(11) - @skipIfONNXShapeInference(False) def test_floating_point_infer_dtype(self): class FloatingPoint(torch.jit.ScriptModule): @torch.jit.script_method @@ -1811,7 +1808,6 @@ def forward(self, x): # In scripting the first transpose node do not carry shape and dtype info. # The following test only works when onnx shape inference is enabled. - @skipIfONNXShapeInference(False) def test_arithmetic_infer_dtype(self): class ArithmeticModule(torch.jit.ScriptModule): @torch.jit.script_method @@ -1894,7 +1890,6 @@ def forward(self, x, y): # In scripting x, y do not carry shape and dtype info. # The following test only works when onnx shape inference is enabled. - @skipIfONNXShapeInference(False) def test_div_promotion_script(self): class DivModule(torch.nn.Module): def forward(self, x, y): @@ -5301,7 +5296,6 @@ def forward(self, x): inputs = torch.randn(16) self.run_test(model, inputs) - @skipIfONNXShapeInference(False) @skipIfUnsupportedMinOpsetVersion(11) def test_loop_transpose(self): class LoopModel(torch.nn.Module): @@ -5653,19 +5647,15 @@ def forward(self, x): x = torch.tensor([2]) self.run_test(ZeroAndOnes(), (x, )) - @skipIfONNXShapeInference(True) @skipIfUnsupportedMinOpsetVersion(9) def test_tolist(self): class List(torch.jit.ScriptModule): @torch.jit.script_method def forward(self, input): - cur_shape = torch._shape_as_tensor(input) - final_shape: List[int] = cur_shape.tolist() - pad_tensor = torch.zeros([1, 2] + final_shape) - return pad_tensor + res: List[int] = input.tolist() + return res - x = torch.randn(2, 3) - self.run_test(List(), (x,)) + self.run_test(List(), (torch.randint(100, (1,)),)) @skipIfUnsupportedMinOpsetVersion(9) def test_list_pass(self): @@ -6158,7 +6148,6 @@ def forward(self, x): input_names=["x"], test_with_inputs=[y]) - @skipIfONNXShapeInference(False) def test_unfold_infer_shape(self): class UnfoldModule(torch.jit.ScriptModule): def __init__(self): @@ -6776,24 +6765,19 @@ def forward(self, x, pad: List[int]): @skipIfUnsupportedMaxOpsetVersion(10) + @disableScriptTest() # TODO: the logic in symbolic_opset9 doesn't handle script def test_unsupported_pad(self): class Pad(torch.nn.Module): - def forward(self, x, pad): + def forward(self, x, pad: List[int]): return torch.nn.functional.pad(x, pad) - def run(): - x = torch.randn(2, 2, 4, 4) - y = pad = (torch.tensor(2, dtype=torch.int32), torch.tensor(4, dtype=torch.int32)) - p = Pad() - f = io.BytesIO() - torch.onnx._export(p, (x, y), f) + x = torch.randn(2, 2, 4, 4) + y = [2, 4] - with self.assertRaises(RuntimeError) as cm: - run() + with self.assertRaisesRegex(RuntimeError, ("Unsupported: ONNX export of Pad.*" + + "The sizes of the padding must be constant")): + self.run_test(Pad(), (x, y)) - the_exception = cm.exception - self.assertEqual("Unsupported: ONNX export of Pad in opset 9. The sizes of the padding must be constant. " + - "Please try opset version 11.", the_exception.args[0]) @skipIfUnsupportedMinOpsetVersion(9) def test_if_fold(self): @@ -6914,7 +6898,6 @@ def forward(self, x, y): self.run_test(IfFoldModel(), (x, y)) @skipIfUnsupportedMinOpsetVersion(11) - @skipIfONNXShapeInference(False) def test_uninitialized(self): class UninitializedModel(torch.nn.Module): def forward(self, y): @@ -6929,7 +6912,6 @@ def forward(self, y): self.run_test(UninitializedModel(), x) @skipIfUnsupportedMinOpsetVersion(11) - @skipIfONNXShapeInference(False) def test_uninitialized_dynamic(self): class UninitializedModel(torch.nn.Module): def forward(self, y): @@ -6948,7 +6930,6 @@ def forward(self, y): # onnx::Identity of sequence supported for ONNX opset >= 14 @skipIfUnsupportedMinOpsetVersion(14) - @skipIfONNXShapeInference(False) def test_uninitialized_tensorList(self): class UninitializedTensorListModel(torch.nn.Module): def forward(self, x): @@ -6964,7 +6945,6 @@ def forward(self, x): # onnx::Identity of sequence supported for ONNX opset >= 14 @skipIfUnsupportedMinOpsetVersion(14) - @skipIfONNXShapeInference(False) def test_uninitialized_tensorList_dynamic(self): class UninitializedTensorListModel(torch.nn.Module): def forward(self, x): @@ -6981,7 +6961,6 @@ def forward(self, x): # onnx::Identity of sequence supported for ONNX opset >= 14 @skipIfUnsupportedMinOpsetVersion(14) - @skipIfONNXShapeInference(False) def test_uninitialized_intList(self): class UninitializedListModel(torch.nn.Module): def forward(self, x): @@ -7000,7 +6979,6 @@ def forward(self, x): # onnx::Identity of sequence supported for ONNX opset >= 14 @skipIfUnsupportedMinOpsetVersion(14) - @skipIfONNXShapeInference(False) def test_uninitialized_tensorList_shape(self): class UninitializedModel(torch.nn.Module): def forward(self, x): @@ -8175,7 +8153,6 @@ def forward(self, x: torch.Tensor): self.run_test(MyModule(), x) - @skipIfONNXShapeInference(False) @skipIfUnsupportedMinOpsetVersion(11) def test_if_transpose(self): class IfModel(torch.nn.Module): @@ -8191,7 +8168,6 @@ def forward(self, x): output_names=["output_1"], dynamic_axes={"output_1": [0, 1]}) - @skipIfONNXShapeInference(False) @skipIfUnsupportedMinOpsetVersion(13) def test_if_list(self): class IfModel(torch.nn.Module): @@ -10697,7 +10673,7 @@ def f(self): **extra_kwargs) f.__name__ = test_name - setattr(TestONNXRuntime, f.__name__, f) + setattr(_TestONNXRuntime, f.__name__, f) def setup_rnn_tests(): layers_opts = [ @@ -10755,7 +10731,7 @@ def setup_rnn_tests(): test_count += 1 # sanity check that a representative example does exist - TestONNXRuntime.test_gru_trilayer_forward_with_initial_state_without_sequence_lengths_with_dropout + _TestONNXRuntime.test_gru_trilayer_forward_with_initial_state_without_sequence_lengths_with_dropout # make sure no one accidentally disables all the tests without # noticing @@ -10765,82 +10741,42 @@ def setup_rnn_tests(): setup_rnn_tests() -# opset 7 tests -TestONNXRuntime_opset7 = type(str("TestONNXRuntime_opset7"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=7)) - -# opset 8 tests -TestONNXRuntime_opset8 = type(str("TestONNXRuntime_opset8"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=8)) - - -# opset 10 tests -TestONNXRuntime_opset10 = type(str("TestONNXRuntime_opset10"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=10)) - -# opset 11 tests -TestONNXRuntime_opset11 = type(str("TestONNXRuntime_opset11"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=11)) - -# opset 12 tests -TestONNXRuntime_opset12 = type(str("TestONNXRuntime_opset12"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=12)) - -# opset 9 tests, with keep_initializers_as_inputs=False for -# IR version 4 style export. -TestONNXRuntime_opset9_IRv4 = type(str("TestONNXRuntime_opset9_IRv4"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, - keep_initializers_as_inputs=False)) - - -# opset 10 tests, with keep_initializers_as_inputs=False for -# IR version 4 style export. -TestONNXRuntime_opset10_IRv4 = type(str("TestONNXRuntime_opset10_IRv4"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=10, - keep_initializers_as_inputs=False)) - - -# opset 11 tests, with keep_initializers_as_inputs=False for -# IR version 4 style export. -TestONNXRuntime_opset11_IRv4 = type(str("TestONNXRuntime_opset11_IRv4"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=11, - keep_initializers_as_inputs=False)) - -# opset 12 tests, with keep_initializers_as_inputs=False for -# IR version 4 style export. -TestONNXRuntime_opset12_IRv4 = type(str("TestONNXRuntime_opset12_IRv4"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=12, - keep_initializers_as_inputs=False)) - -# opset 13 tests -TestONNXRuntime_opset13 = type(str("TestONNXRuntime_opset13"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=13, - keep_initializers_as_inputs=False, - onnx_shape_inference=True)) - -# opset 14 tests -TestONNXRuntime_opset14 = type(str("TestONNXRuntime_opset14"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=14, - keep_initializers_as_inputs=False, - onnx_shape_inference=True)) - -# opset 15 tests -TestONNXRuntime_opset15 = type(str("TestONNXRuntime_opset15"), - (unittest.TestCase,), - dict(TestONNXRuntime.__dict__, opset_version=15, - keep_initializers_as_inputs=False, - onnx_shape_inference=True)) +def MakeTestCase(opset_version: int, keep_initializers_as_inputs: bool = True) -> type: + name = f"TestONNXRuntime_opset{opset_version}" + if not keep_initializers_as_inputs: + name += "_IRv4" + return type(str(name), + (unittest.TestCase,), + dict(_TestONNXRuntime.__dict__, + opset_version=opset_version, + keep_initializers_as_inputs=keep_initializers_as_inputs)) + + +TestONNXRuntime_opset7 = MakeTestCase(7) + +TestONNXRuntime_opset8 = MakeTestCase(8) + +TestONNXRuntime_opset9 = MakeTestCase(9) + +TestONNXRuntime_opset9_IRv4 = MakeTestCase(9, keep_initializers_as_inputs=False) + +TestONNXRuntime_opset10 = MakeTestCase(10) + +TestONNXRuntime_opset10_IRv4 = MakeTestCase(10, keep_initializers_as_inputs=False) + +TestONNXRuntime_opset11 = MakeTestCase(11) + +TestONNXRuntime_opset11_IRv4 = MakeTestCase(11, keep_initializers_as_inputs=False) + +TestONNXRuntime_opset12 = MakeTestCase(12) + +TestONNXRuntime_opset12_IRv4 = MakeTestCase(12, keep_initializers_as_inputs=False) + +TestONNXRuntime_opset13 = MakeTestCase(13, keep_initializers_as_inputs=False) + +TestONNXRuntime_opset14 = MakeTestCase(14, keep_initializers_as_inputs=False) + +TestONNXRuntime_opset15 = MakeTestCase(15, keep_initializers_as_inputs=False) if __name__ == "__main__": diff --git a/test/quantization/eager/test_quantize_eager_ptq.py b/test/quantization/eager/test_quantize_eager_ptq.py index 3f62f70987c0..ec287cd89fa1 100644 --- a/test/quantization/eager/test_quantize_eager_ptq.py +++ b/test/quantization/eager/test_quantize_eager_ptq.py @@ -1459,7 +1459,8 @@ def export_to_onnx(model, input, input_names): model = torch.jit.load(buf) f = io.BytesIO() torch.onnx.export(model, input, f, input_names=input_names, - operator_export_type=torch.onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK) + operator_export_type=torch.onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK, + opset_version=9) onnx_model = export_to_onnx(model, data, input_names) @skipIfNoFBGEMM diff --git a/tools/onnx/update_default_opset_version.py b/tools/onnx/update_default_opset_version.py new file mode 100755 index 000000000000..358bbfdfe39c --- /dev/null +++ b/tools/onnx/update_default_opset_version.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 + +"""Updates the default value of opset_version. + +The current policy is that the default should be set to the +latest released version as of 18 months ago. + +Usage: +Run with no arguments. +""" + +import datetime +import os +import pathlib +import re +import sys +import subprocess +from subprocess import DEVNULL + + +pytorch_dir = pathlib.Path(__file__).parent.parent.parent.resolve() +onnx_dir = pytorch_dir / "third_party" / "onnx" +os.chdir(onnx_dir) + +date = datetime.datetime.now() - datetime.timedelta(days=18 * 30) +onnx_commit = subprocess.check_output(("git", "log", f"--until={date}", "--max-count=1", "--format=%H"), + encoding="utf-8").strip() +onnx_tags = subprocess.check_output(("git", "tag", "--list", f"--contains={onnx_commit}"), encoding="utf-8") +tag_tups = [] +semver_pat = re.compile(r"v(\d+)\.(\d+)\.(\d+)") +for tag in onnx_tags.splitlines(): + match = semver_pat.match(tag) + if match: + tag_tups.append(tuple(int(x) for x in match.groups())) + +version_str = "{}.{}.{}".format(*min(tag_tups)) + +print("Using ONNX release", version_str) + +head_commit = subprocess.check_output(("git", "log", "--max-count=1", "--format=%H", "HEAD"), + encoding="utf-8").strip() + +new_default = None + +subprocess.check_call(("git", "checkout", f"v{version_str}"), stdout=DEVNULL, stderr=DEVNULL) +try: + from onnx import helper # type: ignore[import] + for version in helper.VERSION_TABLE: + if version[0] == version_str: + new_default = version[2] + print("found new default opset_version", new_default) + break + if not new_default: + sys.exit(f"failed to find version {version_str} in onnx.helper.VERSION_TABLE at commit {onnx_commit}") +finally: + subprocess.check_call(("git", "checkout", head_commit), stdout=DEVNULL, stderr=DEVNULL) + +os.chdir(pytorch_dir) + + +def read_sub_write(path: str, prefix_pat: str) -> None: + with open(path, encoding="utf-8") as f: + content_str = f.read() + content_str = re.sub(prefix_pat, r"\g<1>{}".format(new_default), content_str) + with open(path, "w", encoding="utf-8") as f: + f.write(content_str) + print("modified", path) + +read_sub_write(os.path.join("torch", "onnx", "symbolic_helper.py"), + r"(_default_onnx_opset_version = )\d+") +read_sub_write(os.path.join("torch", "onnx", "__init__.py"), + r"(opset_version \(int, default )\d+") + +print("Updating operator .expect files") +subprocess.check_call(("python", "setup.py", "develop"), + stdout=DEVNULL, stderr=DEVNULL) +subprocess.check_call(("python", os.path.join("test", "onnx", "test_operators.py"), "--accept"), + stdout=DEVNULL, stderr=DEVNULL) diff --git a/torch/onnx/__init__.py b/torch/onnx/__init__.py index c41987406411..cf5d1d354367 100644 --- a/torch/onnx/__init__.py +++ b/torch/onnx/__init__.py @@ -195,7 +195,7 @@ def export(model, args, f, export_params=True, verbose=False, training=TrainingM Models exported this way are probably runnable only by Caffe2. - opset_version (int, default 9): The version of the + opset_version (int, default 13): The version of the `default (ai.onnx) opset `_ to target. Must be >= 7 and <= 15. do_constant_folding (bool, default True): Apply the constant-folding optimization. diff --git a/torch/onnx/symbolic_helper.py b/torch/onnx/symbolic_helper.py index c108ab03d758..5690609ac596 100644 --- a/torch/onnx/symbolic_helper.py +++ b/torch/onnx/symbolic_helper.py @@ -970,45 +970,15 @@ def requantize_bias_helper(g, bias, input_scale, weight_scale): to_i=torch.onnx.TensorProtoDataType.INT32) return g.op("prim::TupleConstruct", q_bias, bias_scale, bias_zero_point) -# --------------------------------------------------------------------- -# ONNX operator version -# --------------------------------------------------------------------- - -# READ ME BEFORE EDITING _default_onnx_opset_version: -# -# The variable below controls which ONNX operator set version we are -# targeting. THIS VARIABLE HAS SEMANTIC EFFECT! Say a breaking -# change occurred in version 8. As long as this variable < 8, you can -# export models targeting the old behavior. However, if you bump -# this variable to 8 or later, the breaking change will take into effect: -# you MUST adjust any symbolic affected by breaking changes. The ONNX -# spec publishes a *comprehensive* list of BC-breaking changes for every -# operator revision at: -# -# https://github.com/onnx/onnx/blob/master/docs/Changelog.md -# -# Please be sure to go through and check all of our implementations here before -# increasing this number. This includes symbolic definitions NOT in this -# file, so grep for "OpName" (with quotes) -# -# Besides, opset_version can be specified in the invocation of export() -# and export_to_pretty_string(), and _export_onnx_opset_version will be set -# and the symbolic functions should check it to determine the behavior -# of the exporter. - - -_default_onnx_opset_version = 9 +_default_onnx_opset_version = 13 _onnx_main_opset = 15 -_onnx_stable_opsets = [7, 8, 9, 10, 11, 12, 13, 14] +_onnx_stable_opsets = list(range(7, _onnx_main_opset)) _export_onnx_opset_version = _default_onnx_opset_version _constant_folding_opset_versions = list(range(9, _onnx_main_opset + 1)) def _set_opset_version(opset_version): global _export_onnx_opset_version - if opset_version == _default_onnx_opset_version: - _export_onnx_opset_version = opset_version - return if opset_version in _onnx_stable_opsets + [_onnx_main_opset]: _export_onnx_opset_version = opset_version return