こんな感じに、ONNX モデルを取り込み、実行できるようです。
引用 # Import ONNX and load an ONNX file from disk >>> import onnx >>> onnx_protobuf = onnx.load('/path/to/ResNet20_CIFAR10_model.onnx') # Convert ONNX model to an ngraph model >>> from ngraph_onnx.onnx_importer.importer import import_onnx_model >>> ng_models = import_onnx_model(onnx_protobuf) # The importer returns a list of ngraph models for every ONNX graph output: >>> print(ng_models) [{ 'name': 'Plus5475_Output_0', 'output': <Add: 'Add_1972' ([1, 10])>, 'inputs': [<Parameter: 'Parameter_1104' ([1, 3, 32, 32], float)>] }] # Using an ngraph runtime (CPU backend) create a callable computation >>> import ngraph as ng >>> ng_model = ng_models[0] >>> runtime = ng.runtime(backend_name='CPU') >>> resnet = runtime.computation(ng_model['output'], *ng_model['inputs']) # Load an image (or create a mock as in this example) >>> import numpy as np >>> picture = np.ones([1, 3, 32, 32]) # Run computation on the picture: >>> resnet(picture) array( 1.312082 , -1.6729496, 4.2079577, 1.4012241, -3.5463796, 2.3433776, 1.7799224, -1.6155214, 0.0777044, -4.2944093, dtype=float32)
サポートされていない ONNX のオペレーションは、これだけあります。
Unsupported ONNX operations ArgMax ArgMin Cast ConvTranspose DepthToSpace Dropout GRU Gather GlobalLpPool Hardmax InstanceNormalization LRN LSTM LpNormalization LpPool MaxRoiPool Pow RNN RandomNormal RandomNormalLike RandomUniform RandomUniformLike ReduceL1 ReduceL2 ReduceLogSum ReduceSumSquare Shape Size SpaceToDepth Tile TopK