File: update_onnx_opset.py

package info (click to toggle)
onnxruntime 1.23.2%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 340,756 kB
  • sloc: cpp: 3,222,136; python: 188,267; ansic: 114,318; asm: 37,927; cs: 36,849; java: 10,962; javascript: 6,811; pascal: 4,126; sh: 2,996; xml: 705; objc: 281; makefile: 67
file content (31 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import argparse
import os
import pathlib

from .onnx_model_utils import update_onnx_opset


def update_onnx_opset_helper():
    parser = argparse.ArgumentParser(
        f"{os.path.basename(__file__)}:{update_onnx_opset_helper.__name__}",
        description="""
                                     Update the ONNX opset of the model.
                                     New opset must be later than the existing one.
                                     If not specified will update to opset 15.
                                     """,
    )

    parser.add_argument("--opset", type=int, required=False, default=15, help="ONNX opset to update to.")
    parser.add_argument("input_model", type=pathlib.Path, help="Provide path to ONNX model to update.")
    parser.add_argument("output_model", type=pathlib.Path, help="Provide path to write updated ONNX model to.")

    args = parser.parse_args()
    update_onnx_opset(args.input_model, args.opset, args.output_model)


if __name__ == "__main__":
    update_onnx_opset_helper()