<jupyter_start><jupyter_text>Version ConversionThe ONNX Version Converter helps convert ONNX models to the version needed by the runtime you are using.Version Conversion for BatchNormalization from opset 8 to 9:  当前版本![](../images/super-resolution.png) 下载resnet18的onnx权重：https://github.com/onnx/models/tree/master/vision/classification/resnet/model  Downgrade Version Conversion from 9 to 8:<jupyter_code>import onnx

# Load the model
model = onnx.load("../models/resnet18.onnx")

# # Check that the IR is well formed
onnx.checker.check_model(model)

from onnx import version_converter

# # Convert to version 8
converted_model = version_converter.convert_version(model, 8)

# Save model
onnx.save(converted_model, "../models/resnet18_v8.onnx")<jupyter_output><empty_output><jupyter_text>Upgrade Version Conversion from 8 to 9<jupyter_code># Convert to version 9
converted_model9 = version_converter.convert_version(converted_model, 9)

# Save model
onnx.save(converted_model9, "../models/resnet18_v9.onnx")<jupyter_output><empty_output><jupyter_text>Downgrade Version Conversion from 8 to 7<jupyter_code># Convert to version 7
converted_model7 = version_converter.convert_version(converted_model, 7)

# Save model
onnx.save(converted_model7, "../models/resnet18_v7.onnx")<jupyter_output><empty_output><jupyter_text>Upgrade Version Conversion from 7 to 9<jupyter_code># Convert to version 9
converted_model79 = version_converter.convert_version(converted_model7, 9)

# Save model
onnx.save(converted_model79, "../models/resnet18_v79.onnx")
!pip list<jupyter_output>Package                Version
---------------------- -------------------
absl-py                0.9.0
adabound               0.0.5
appdirs                1.4.4
asn1crypto             0.24.0
attrs                  17.4.0
Automat                0.6.0
backcall               0.2.0
bleach                 3.1.5
blinker                1.4
cachetools             4.1.1
certifi                2018.1.18
cffi                   1.14.0
chardet                3.0.4
click                  6.7
cloud-init             19.4
cloudpickle            1.4.1
colorama               0.3.7
command-not-found      0.3
configobj              5.0.6
constantly             15.1.0
cryptography           2.1.4
cycler                 0.10.0
Cython                 0.29.17
decorator              4.4.2
defusedxml             0.6.0
distro-info            0.18ubuntu0.18.04.1
entrypoints            0.3
fire                   0.3.1
Flask                  1.1.2
future                 0.18.2
google-auth            1.18.0
google-au[...]
{'fraction_non_alphanumeric': 0.10233463035019455, 'fraction_numerical': 0.059533073929961086, 'mean_word_length': 2.154601226993865, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '569926', 'license': 'MIT', 'n_tokens_mistral': 907, 'n_tokens_neox': 840, 'n_words': 182, 'path': 'jupyter/VersionConversion.ipynb', 'repo_name': 'FelixFu520/onnx', 'size': '2570'}