ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onnx-si.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
3# Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17import onnx
18import os
19import sys
20
21
22def _help_exit(cmd_name):
23 print('Produce shape-infered ONNX file')
24 print('Usage: {0} [onnx_in_path] [onnx_out_path]'.format(cmd_name))
25 print('')
26 exit()
27
28
29def main():
30 if len(sys.argv) < 3:
31 _help_exit(os.path.basename(sys.argv[0]))
32
33 onnx.checker.check_model(sys.argv[1])
34 onnx.shape_inference.infer_shapes_path(sys.argv[1], sys.argv[2])
35
36
37if __name__ == "__main__":
38 main()
main()
Definition onnx-si.py:29
_help_exit(cmd_name)
Definition onnx-si.py:22