[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)
diff --git a/scripts/onnx/test.sh b/scripts/onnx/test.sh
index 3b39f60..dbeb6b2 100755
--- a/scripts/onnx/test.sh
+++ b/scripts/onnx/test.sh
@@ -69,7 +69,7 @@
   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 70d2193..300be7d 100644
--- a/test/jit/test_export_modes.py
+++ b/test/jit/test_export_modes.py
@@ -82,7 +82,9 @@
             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 bcf9463..40fc61e 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 @@
   }
 }
 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 72d6946..569b240 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 @@
   }
 }
 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 81a0689..ffa632c 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 @@
   }
 }
 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 ffdf6ef..9917880 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 @@
   }
 }
 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 72d6946..569b240 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 @@
   }
 }
 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 a00ddab..96d2dca 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 @@
   }
 }
 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 8494b62..0e1570e 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 @@
   }
 }
 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 ee46983..1ef0a81 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 @@
   }
 }
 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 a10b3bb..38add71 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 @@
       i: 0
       type: INT
     }
+    attribute {
+      name: "select_last_index"
+      i: 0
+      type: INT
+    }
   }
   name: "torch_jit"
   input {
@@ -50,5 +55,5 @@
   }
 }
 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 a6197de..f5a44b8 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 @@
   }
 }
 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 346cf77..8d4ba07 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 @@
   }
 }
 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 d9a034a..c8d189e 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 @@
   }
 }
 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 cb5da7e..344022e 100644
--- a/test/onnx/expect/TestOperators.test_avg_pool2d.expect
+++ b/test/onnx/expect/TestOperators.test_avg_pool2d.expect
@@ -1,41 +1,44 @@
-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
       ints: 3
@@ -80,7 +83,7 @@
     }
   }
   output {
-    name: "2"
+    name: "3"
     type {
       tensor_type {
         elem_type: 1
@@ -103,5 +106,5 @@
   }
 }
 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 66fe451..fc7eb0f 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 @@
   }
 }
 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 88d53eb..3d151ae 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 @@
   }
 }
 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 1bd402f..d9c9ec3 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 @@
   }
 }
 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 426fb72..a4d2e1f 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 @@
   }
 }
 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 88f4fdc..a421443 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 @@
   }
 }
 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 0d80bed..a556e38 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 @@
   }
 }
 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 9090a8f..5e8f204 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 @@
   }
 }
 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 f497367..575245c8 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: "split"
-      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 {
+    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: "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 @@
     }
   }
   output {
-    name: "1"
+    name: "11"
     type {
       tensor_type {
         elem_type: 1
@@ -48,7 +178,7 @@
     }
   }
   output {
-    name: "2"
+    name: "14"
     type {
       tensor_type {
         elem_type: 1
@@ -62,5 +192,5 @@
   }
 }
 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 50293fd..8160685 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 @@
     }
   }
   output {
-    name: "1"
+    name: "5"
     type {
       tensor_type {
         elem_type: 1
@@ -53,5 +55,5 @@
   }
 }
 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 bb7bd0f..ceb89b3 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 @@
     }
   }
   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 @@
   }
 }
 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 cda3b10..22826be 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 @@
     }
   }
   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 @@
   }
 }
 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 b5102e0..f5b6aec 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 @@
   }
 }
 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 55fe131..f1078ce 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 @@
   }
 }
 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 980f9fa..18e3c68 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 @@
   }
 }
 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 2224158..0beedca 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 @@
   }
 }
 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 7b08d88..1185bca 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 @@
   }
 }
 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 42a4855..e041d53 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 @@
   }
 }
 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 3e72400..eaab275 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 @@
   }
 }
 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 77480e6..59e910a 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 @@
   }
 }
 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 407a1af..27aab5c 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 @@
   }
 }
 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 523ec6b..89c0e98 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: "ratio"
-      f: 0.5
-      type: FLOAT
+      name: "value"
+      t {
+        data_type: 1
+        raw_data: "\000\000\000?"
+      }
+      type: TENSOR
     }
   }
   node {
-    input: "onnx::ReduceMax_1"
-    output: "3"
-    name: "ReduceMax_1"
+    output: "onnx::Dropout_2"
+    name: "Constant_1"
+    op_type: "Constant"
+    attribute {
+      name: "value"
+      t {
+        data_type: 9
+        raw_data: "\001"
+      }
+      type: TENSOR
+    }
+  }
+  node {
+    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 @@
     }
   }
   output {
-    name: "3"
+    name: "5"
     type {
       tensor_type {
         elem_type: 1
@@ -54,5 +77,5 @@
   }
 }
 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 523ec6b..89c0e98 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: "ratio"
-      f: 0.5
-      type: FLOAT
+      name: "value"
+      t {
+        data_type: 1
+        raw_data: "\000\000\000?"
+      }
+      type: TENSOR
     }
   }
   node {
-    input: "onnx::ReduceMax_1"
-    output: "3"
-    name: "ReduceMax_1"
+    output: "onnx::Dropout_2"
+    name: "Constant_1"
+    op_type: "Constant"
+    attribute {
+      name: "value"
+      t {
+        data_type: 9
+        raw_data: "\001"
+      }
+      type: TENSOR
+    }
+  }
+  node {
+    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 @@
     }
   }
   output {
-    name: "3"
+    name: "5"
     type {
       tensor_type {
         elem_type: 1
@@ -54,5 +77,5 @@
   }
 }
 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 c43a382..9fc2d5a 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 @@
   }
 }
 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 77dbd6a..dfa1afd 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: "include_last_offset"
+      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: "axis"
       i: 0
       type: INT
     }
+  }
+  node {
+    output: "onnx::Unsqueeze_9"
+    op_type: "Constant"
     attribute {
-      name: "mode"
-      i: 1
-      type: INT
+      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: "operator"
-      s: "embedding_bag"
-      type: STRING
-    }
-    attribute {
-      name: "overload_name"
-      s: ""
-      type: STRING
-    }
-    attribute {
-      name: "scale_grad_by_freq"
+      name: "axis"
       i: 0
       type: INT
     }
+  }
+  node {
+    output: "onnx::Slice_12"
+    op_type: "Constant"
     attribute {
-      name: "sparse"
+      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: "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: "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: "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 @@
     }
   }
   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 @@
   }
 }
 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 1293acb..e4f6c6e 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 @@
   }
 }
 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 21c1e7f..5a9877d 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 @@
   }
 }
 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 6568ca8..f8f70c3 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 @@
   }
 }
 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 b270bab..49d9f74 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 @@
   }
 }
 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 988830e..6634173 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 @@
   }
 }
 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 48def60..12160e8 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,28 +9,21 @@
     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
-    }
-    attribute {
-      name: "ends"
-      ints: 0
-      type: INTS
-    }
-    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"
+    output: "onnx::Slice_3"
     name: "Constant_2"
     op_type: "Constant"
     attribute {
@@ -38,16 +31,53 @@
       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: "value"
+      t {
+        dims: 1
+        data_type: 7
+        raw_data: "\000\000\000\000\000\000\000\000"
+      }
+      type: TENSOR
+    }
+  }
+  node {
+    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"
+      t {
+        dims: 1
+        data_type: 7
         raw_data: "\377\377\377\377\377\377\377\377"
       }
       type: TENSOR
     }
   }
   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 @@
   }
   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 @@
     }
   }
   output {
-    name: "5"
+    name: "8"
     type {
       tensor_type {
         elem_type: 1
@@ -100,5 +130,5 @@
   }
 }
 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 0418862..f60b1ba 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 @@
   }
 }
 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 b1af326..fba4585 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 {
-    input: "x"
-    input: "x"
     output: "onnx::ReduceSum_1"
-    name: "Mul_0"
+    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_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 @@
     }
   }
   output {
-    name: "3"
+    name: "4"
     type {
       tensor_type {
         elem_type: 1
@@ -73,5 +87,5 @@
   }
 }
 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 d3526e4..fc8acf5 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 @@
   }
 }
 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 d3526e4..fc8acf5 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 @@
   }
 }
 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 dde397e..609f898 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 @@
     }
   }
   input {
-    name: "onnx::OneHot_1"
+    name: "onnx::GatherElements_1"
     type {
       tensor_type {
         elem_type: 7
@@ -146,7 +54,7 @@
     }
   }
   output {
-    name: "10"
+    name: "2"
     type {
       tensor_type {
         elem_type: 1
@@ -166,5 +74,5 @@
   }
 }
 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 5246ccf..8d578a4 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 @@
     }
   }
   input {
-    name: "onnx::Less_1"
+    name: "onnx::GreaterOrEqual_1"
     type {
       tensor_type {
         elem_type: 6
@@ -49,7 +43,7 @@
     }
   }
   output {
-    name: "3"
+    name: "2"
     type {
       tensor_type {
         elem_type: 9
@@ -66,5 +60,5 @@
   }
 }
 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 d59cafa..dfc7d1d 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 @@
   }
 }
 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 903ea41..5aab777 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 @@
   }
 }
 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 70a3732..1268a4c 100644
--- a/test/onnx/expect/TestOperators.test_hardtanh.expect
+++ b/test/onnx/expect/TestOperators.test_hardtanh.expect
@@ -1,22 +1,40 @@
-ir_version: 4
+ir_version: 7
 producer_name: "pytorch"
 producer_version: "CURRENT_VERSION"
 graph {
   node {
+    output: "onnx::Clip_1"
+    name: "Constant_0"
+    op_type: "Constant"
+    attribute {
+      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: "value"
+      t {
+        data_type: 1
+        raw_data: "\000\000\000?"
+      }
+      type: TENSOR
+    }
+  }
+  node {
     input: "input"
-    output: "1"
-    name: "Clip_0"
+    input: "onnx::Clip_1"
+    input: "onnx::Clip_2"
+    output: "3"
+    name: "Clip_2"
     op_type: "Clip"
-    attribute {
-      name: "max"
-      f: 0.5
-      type: FLOAT
-    }
-    attribute {
-      name: "min"
-      f: -0.5
-      type: FLOAT
-    }
   }
   name: "torch_jit"
   input {
@@ -36,7 +54,7 @@
     }
   }
   output {
-    name: "1"
+    name: "3"
     type {
       tensor_type {
         elem_type: 1
@@ -53,5 +71,5 @@
   }
 }
 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 db37957..3c94edc 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 @@
   }
 }
 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 1ea803f..330d2de 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 @@
   }
 }
 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 db7a683..198d3bd 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 @@
   }
 }
 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 f231db4..d7b7ac5 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 @@
   }
 }
 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 c0b0d67..374a0d0 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 @@
     }
   }
   input {
-    name: "onnx::Greater_1"
+    name: "onnx::LessOrEqual_1"
     type {
       tensor_type {
         elem_type: 6
@@ -49,7 +43,7 @@
     }
   }
   output {
-    name: "3"
+    name: "2"
     type {
       tensor_type {
         elem_type: 9
@@ -66,5 +60,5 @@
   }
 }
 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 372c342..71c64df 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 @@
   }
 }
 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 993490e..2681f11 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 @@
   }
 }
 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 d01223a..1c4de89 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 @@
   }
 }
 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 57b6366..2dbcc07 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 @@
   }
 }
 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 295f32c..d9fcc0f 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 @@
   }
 }
 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 13dabcf..f43712b 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 {
@@ -8,6 +8,11 @@
     name: "MaxPool_0"
     op_type: "MaxPool"
     attribute {
+      name: "ceil_mode"
+      i: 0
+      type: INT
+    }
+    attribute {
       name: "kernel_shape"
       ints: 3
       type: INTS
@@ -65,5 +70,5 @@
   }
 }
 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 249112a..46c23e3 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 {
@@ -9,6 +9,11 @@
     name: "MaxPool_0"
     op_type: "MaxPool"
     attribute {
+      name: "ceil_mode"
+      i: 0
+      type: INT
+    }
+    attribute {
       name: "kernel_shape"
       ints: 3
       type: INTS
@@ -43,31 +48,61 @@
     }
   }
   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
-    }
-    attribute {
-      name: "ends"
-      ints: 1
-      type: INTS
-    }
-    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 {
+    output: "onnx::Slice_6"
+    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::Slice_7"
+    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::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 @@
     }
   }
   output {
-    name: "6"
+    name: "9"
     type {
       tensor_type {
         elem_type: 7
@@ -130,5 +165,5 @@
   }
 }
 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 8148bfd..b53b8c2 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 @@
   }
 }
 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 dfda5eb..92ce0ae 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 @@
   }
 }
 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 ba0edfb..05b9de8 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 @@
   }
 }
 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 12945fa..28ca147 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 @@
   }
 }
 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 4b436e8..9492d65 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 @@
     }
   }
   output {
-    name: "3"
+    name: "2"
     type {
       tensor_type {
         elem_type: 1
@@ -85,5 +70,5 @@
   }
 }
 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 52e3e9c..a7b13c8 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 @@
     }
   }
   output {
-    name: "1"
+    name: "12"
     type {
       tensor_type {
         elem_type: 1
@@ -58,5 +64,5 @@
   }
 }
 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 55d3512..ab053fb 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 @@
   }
 }
 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 9090e39..cfcb1f5 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 @@
   }
 }
 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 df15562..ec5e12b 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 @@
   }
 }
 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 1fadd7a..0388ec6 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 @@
   }
 }
 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 30e234c..fafec78 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 @@
   }
 }
 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 ab81252..0a25fb0 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 @@
     }
   }
   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 @@
   }
 }
 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 1d1bd7d..67064d8 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 @@
   }
 }
 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 d6ddd54..8dbc34a 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 @@
   }
 }
 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 42310b8..7f7b6af 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 @@
   }
 }
 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 56dd281..f20fd95 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 @@
   }
 }
 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 f38134f..f2bcb50 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 @@
     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 @@
     }
   }
   input {
-    name: "onnx::PRelu_4"
+    name: "onnx::PRelu_5"
     type {
       tensor_type {
         elem_type: 1
@@ -60,7 +60,7 @@
     }
   }
   output {
-    name: "3"
+    name: "4"
     type {
       tensor_type {
         elem_type: 1
@@ -83,5 +83,5 @@
   }
 }
 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 33b1f0e..0cfeafa 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 @@
   }
 }
 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 d9359ba..26a63ac 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 @@
   }
 }
 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 02e239b..b4d2dbd 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 @@
   }
 }
 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 ef8c518..bc2d0b2 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 @@
   }
 }
 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 044a4b4..7e5fefa 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 @@
     }
   }
   output {
-    name: "1"
+    name: "2"
     type {
       tensor_type {
         elem_type: 1
@@ -50,5 +60,5 @@
   }
 }
 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 f5da3dc..ce69ab6 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 @@
   }
 }
 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 231d847..71d9d29 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 @@
   }
 }
 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 3ab9b26..98bb26a 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 @@
   }
 }
 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 2d28199..cdfbc0f 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 @@
   }
 }
 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 a6bcac8..641d21c 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 @@
   }
 }
 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 edfe354..62befc2 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 @@
   }
 }
 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 69f8abd..e03a204 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 @@
     }
   }
   output {
-    name: "1"
+    name: "2"
     type {
       tensor_type {
         elem_type: 1
@@ -60,5 +69,5 @@
   }
 }
 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 59fdbf2..e8ffa49 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,16 +28,12 @@
     }
   }
   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
       type: INT
@@ -53,7 +63,7 @@
     }
   }
   output {
-    name: "2"
+    name: "3"
     type {
       tensor_type {
         elem_type: 11
@@ -73,5 +83,5 @@
   }
 }
 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 6c3498d..7d05fdc 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 @@
     }
   }
   output {
-    name: "1"
+    name: "2"
     type {
       tensor_type {
         elem_type: 1
@@ -65,5 +75,5 @@
   }
 }
 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 015621e..bbd7707 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 @@
   }
 }
 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 ba713c9..a555fac 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 @@
   }
 }
 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 75799ad..ecf4414 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 @@
   }
 }
 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 e87fce2..5206bce 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 @@
   }
 }
 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 fb0730a..2dbb3a4 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 @@
   }
 }
 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 959a842..3fb75ab 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 @@
   }
 }
 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 3f0b2f6..32e4df5 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 @@
   }
 }
 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 fcc5e3e4..75344bf 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 @@
   }
 }
 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 7e56049..fd7514e 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 @@
     }
   }
   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 @@
     }
   }
   input {
-    name: "onnx::Scatter_1"
+    name: "onnx::ScatterElements_1"
     type {
       tensor_type {
         elem_type: 7
@@ -71,7 +71,7 @@
     }
   }
   input {
-    name: "onnx::Scatter_2"
+    name: "onnx::ScatterElements_2"
     type {
       tensor_type {
         elem_type: 1
@@ -104,5 +104,5 @@
   }
 }
 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 9469c94..7cdc4dc 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 @@
   }
 }
 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 c0044e4..174551f 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 @@
     }
   }
   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 @@
   }
   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 @@
     }
   }
   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 @@
     }
   }
   output {
-    name: "20"
+    name: "25"
     type {
       tensor_type {
         elem_type: 1
@@ -199,5 +205,5 @@
   }
 }
 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 0cf0a0f..6cb9200 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 @@
   }
 }
 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 2e5710f..4ca6284 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 @@
   }
 }
 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 7556255..15aa37b 100644
--- a/test/onnx/expect/TestOperators.test_slice.expect
+++ b/test/onnx/expect/TestOperators.test_slice.expect
@@ -1,27 +1,72 @@
-ir_version: 4
+ir_version: 7
 producer_name: "pytorch"
 producer_version: "CURRENT_VERSION"
 graph {
   node {
+    output: "onnx::Slice_1"
+    name: "Constant_0"
+    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_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: "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: "value"
+      t {
+        dims: 1
+        data_type: 7
+        raw_data: "\001\000\000\000\000\000\000\000"
+      }
+      type: TENSOR
+    }
+  }
+  node {
     input: "onnx::Slice_0"
-    output: "1"
-    name: "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"
-    attribute {
-      name: "axes"
-      ints: 1
-      type: INTS
-    }
-    attribute {
-      name: "ends"
-      ints: 2
-      type: INTS
-    }
-    attribute {
-      name: "starts"
-      ints: 1
-      type: INTS
-    }
   }
   name: "torch_jit"
   input {
@@ -41,7 +86,7 @@
     }
   }
   output {
-    name: "1"
+    name: "5"
     type {
       tensor_type {
         elem_type: 1
@@ -58,5 +103,5 @@
   }
 }
 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 bd11058..e1616e4 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,22 +48,6 @@
     }
   }
   output {
-    name: "1"
-    type {
-      tensor_type {
-        elem_type: 1
-        shape {
-          dim {
-            dim_value: 2
-          }
-          dim {
-            dim_value: 2
-          }
-        }
-      }
-    }
-  }
-  output {
     name: "2"
     type {
       tensor_type {
@@ -87,7 +79,23 @@
       }
     }
   }
+  output {
+    name: "4"
+    type {
+      tensor_type {
+        elem_type: 1
+        shape {
+          dim {
+            dim_value: 2
+          }
+          dim {
+            dim_value: 2
+          }
+        }
+      }
+    }
+  }
 }
 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 359135c..964ba36 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 @@
     }
   }
   output {
-    name: "1"
+    name: "2"
     type {
       tensor_type {
         elem_type: 1
@@ -56,7 +64,7 @@
     }
   }
   output {
-    name: "2"
+    name: "3"
     type {
       tensor_type {
         elem_type: 1
@@ -72,7 +80,7 @@
     }
   }
   output {
-    name: "3"
+    name: "4"
     type {
       tensor_type {
         elem_type: 1
@@ -89,5 +97,5 @@
   }
 }
 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 67e86c2..91fc7ba 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 @@
   }
 }
 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 957ac19..69df37b 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 @@
   }
 }
 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 d923dab..6722064 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 @@
   }
 }
 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 3457c4d..2b5f417 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 @@
   }
 }
 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 1ff7b8e..84bc3e9 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 @@
   }
 }
 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 41227d0..f1350a1 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 @@
   }
 }
 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 2af30c6..3180348 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 @@
   }
 }
 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 58675ad..9b5e202 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
-    }
-    attribute {
-      name: "ends"
-      ints: 4
-      type: INTS
-    }
-    attribute {
-      name: "starts"
-      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_1"
-    output: "onnx::Concat_3"
-    name: "Unsqueeze_2"
+    output: "onnx::Slice_6"
+    name: "Constant_5"
+    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 {
+    output: "onnx::Slice_7"
+    name: "Constant_6"
+    op_type: "Constant"
+    attribute {
+      name: "value"
+      t {
+        dims: 1
+        data_type: 7
+        raw_data: "\004\000\000\000\000\000\000\000"
+      }
+      type: TENSOR
+    }
+  }
+  node {
+    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: "value"
+      t {
+        dims: 1
+        data_type: 7
+        raw_data: "\002\000\000\000\000\000\000\000"
+      }
+      type: TENSOR
+    }
+  }
+  node {
+    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::Unsqueeze_2"
-    output: "onnx::Concat_4"
-    name: "Unsqueeze_3"
+    input: "onnx::Unsqueeze_8"
+    input: "onnx::Unsqueeze_11"
+    output: "onnx::Concat_12"
+    name: "Unsqueeze_11"
     op_type: "Unsqueeze"
-    attribute {
-      name: "axes"
-      ints: 2
-      type: INTS
-    }
   }
   node {
-    input: "onnx::Concat_3"
-    input: "onnx::Concat_4"
-    output: "5"
-    name: "Concat_4"
+    input: "onnx::Concat_10"
+    input: "onnx::Concat_12"
+    output: "13"
+    name: "Concat_12"
     op_type: "Concat"
     attribute {
       name: "axis"
@@ -99,7 +179,7 @@
     }
   }
   output {
-    name: "5"
+    name: "13"
     type {
       tensor_type {
         elem_type: 1
@@ -122,5 +202,5 @@
   }
 }
 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 215b766..49a61c2 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 @@
     }
   }
   output {
-    name: "1"
+    name: "2"
     type {
       tensor_type {
         elem_type: 1
@@ -51,5 +61,5 @@
   }
 }
 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 a05dc82..e1f31dc 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 @@
     }
   }
   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 @@
   }
 }
 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 a05dc82..e1f31dc 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 @@
     }
   }
   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 @@
   }
 }
 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 e597ddf..cbd3260 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: 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: "\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: 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 @@
     }
   }
   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 @@
   }
 }
 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 cb79b41..0976258 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 @@
   }
 }
 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 ae9d957..ac81416 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 @@
   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 @@
     }
   }
   output {
-    name: "6"
+    name: "8"
     type {
       tensor_type {
         elem_type: 1
@@ -56,5 +56,5 @@
   }
 }
 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 1293acb..e4f6c6e 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 @@
   }
 }
 opset_import {
-  version: 9
+  version: 13
 }
diff --git a/test/onnx/test_models.py b/test/onnx/test_models.py
index e8fad94..1f2e025 100644
--- a/test/onnx/test_models.py
+++ b/test/onnx/test_models.py
@@ -46,15 +46,15 @@
 
 
 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 13b4585..35a408e 100644
--- a/test/onnx/test_pytorch_common.py
+++ b/test/onnx/test_pytorch_common.py
@@ -50,17 +50,17 @@
     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 @@
         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 72ff939..31c2287 100644
--- a/test/onnx/test_pytorch_onnx_caffe2.py
+++ b/test/onnx/test_pytorch_onnx_caffe2.py
@@ -117,8 +117,7 @@
 
 
 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 b427b85..bb84ab6 100644
--- a/test/onnx/test_pytorch_onnx_caffe2_quantized.py
+++ b/test/onnx/test_pytorch_onnx_caffe2_quantized.py
@@ -31,7 +31,9 @@
 
         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 @@
         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 19aa58b..228e490 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 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 @@
                        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 @@
                                    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 @@
     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 @@
 
     # 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 @@
 
     # 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 @@
 
     # 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 @@
 
     # 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 @@
         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 @@
         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 @@
                       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 @@
 
 
     @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 @@
         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 @@
         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 @@
 
     # 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 @@
 
     # 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 @@
 
     # 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 @@
 
     # 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 @@
 
         self.run_test(MyModule(), x)
 
-    @skipIfONNXShapeInference(False)
     @skipIfUnsupportedMinOpsetVersion(11)
     def test_if_transpose(self):
         class IfModel(torch.nn.Module):
@@ -8191,7 +8168,6 @@
                       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 @@
             **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 @@
             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 @@
 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))
+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))
 
 
-# opset 10 tests
-TestONNXRuntime_opset10 = type(str("TestONNXRuntime_opset10"),
-                               (unittest.TestCase,),
-                               dict(TestONNXRuntime.__dict__, opset_version=10))
+TestONNXRuntime_opset7 = MakeTestCase(7)
 
-# opset 11 tests
-TestONNXRuntime_opset11 = type(str("TestONNXRuntime_opset11"),
-                               (unittest.TestCase,),
-                               dict(TestONNXRuntime.__dict__, opset_version=11))
+TestONNXRuntime_opset8 = MakeTestCase(8)
 
-# opset 12 tests
-TestONNXRuntime_opset12 = type(str("TestONNXRuntime_opset12"),
-                               (unittest.TestCase,),
-                               dict(TestONNXRuntime.__dict__, opset_version=12))
+TestONNXRuntime_opset9 = MakeTestCase(9)
 
-# 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))
+TestONNXRuntime_opset9_IRv4 = MakeTestCase(9, keep_initializers_as_inputs=False)
 
+TestONNXRuntime_opset10 = MakeTestCase(10)
 
-# 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))
+TestONNXRuntime_opset10_IRv4 = MakeTestCase(10, keep_initializers_as_inputs=False)
 
+TestONNXRuntime_opset11 = MakeTestCase(11)
 
-# 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))
+TestONNXRuntime_opset11_IRv4 = MakeTestCase(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))
+TestONNXRuntime_opset12 = MakeTestCase(12)
 
-# 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))
+TestONNXRuntime_opset12_IRv4 = MakeTestCase(12, keep_initializers_as_inputs=False)
 
-# 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))
+TestONNXRuntime_opset13 = MakeTestCase(13, keep_initializers_as_inputs=False)
 
-# 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))
+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 3f62f70..ec287cd 100644
--- a/test/quantization/eager/test_quantize_eager_ptq.py
+++ b/test/quantization/eager/test_quantize_eager_ptq.py
@@ -1459,7 +1459,8 @@
             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 0000000..358bbfd
--- /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 c4198740..cf5d1d3 100644
--- a/torch/onnx/__init__.py
+++ b/torch/onnx/__init__.py
@@ -195,7 +195,7 @@
 
                 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 <https://github.com/onnx/onnx/blob/master/docs/Operators.md>`_
             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 c108ab0..5690609 100644
--- a/torch/onnx/symbolic_helper.py
+++ b/torch/onnx/symbolic_helper.py
@@ -970,45 +970,15 @@
                   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