Coverage for onnxcustom/__init__.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# coding: utf-8
2# flake8: noqa: F401
3# pylint: disable=W0611,C0415
4"""
5@file
6@brief Experimentation with ONNX, examples.
7"""
9__version__ = "0.4.293"
10__author__ = "Xavier Dupré, ..."
11__max_supported_opset__ = 15 # Converters are tested up to this version.
12__max_supported_opsets__ = {
13 '': __max_supported_opset__,
14 'ai.onnx.ml': 2}
17def check(verbose=1):
18 """
19 Runs a couple of functions to check the module is working.
21 :param verbose: 0 to hide the standout output
22 :return: list of dictionaries, result of each test
23 """
24 tests = []
25 try:
26 import onnx
27 import onnx.helper
28 except ImportError as e: # pragma: no cover
29 tests.append(dict(test='onnx', exc=e))
30 try:
31 import onnxruntime
32 from onnxruntime import InferenceSession
33 except ImportError as e: # pragma: no cover
34 tests.append(dict(test='onnxruntime', exc=e))
35 try:
36 import onnxruntime.training
37 from onnxruntime.training import TrainingSession
38 except ImportError as e: # pragma: no cover
39 tests.append(dict(test='onnxruntime_training', exc=e))
40 try:
41 import skl2onnx
42 from skl2onnx import to_onnx
43 except ImportError as e: # pragma: no cover
44 tests.append(dict(test='skl2onnx', exc=e))
45 return tests
48def get_max_opset():
49 """
50 Returns the highest available onnx opset version.
51 """
52 from onnx.defs import onnx_opset_version
53 return min(onnx_opset_version(), __max_supported_opset__)