nngen icon indicating copy to clipboard operation
nngen copied to clipboard

KeyError: 'MatMul'

Open pbelecky opened this issue 4 years ago • 0 comments

Error while running nngen.from_onnx()

Download the onnx file: https://github.com/onnx/models/blob/master/vision/classification/mnist/model/mnist-1.onnx

And run Python code:

import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(
    os.path.dirname(os.path.abspath(__file__)))))

import nngen as ng

act_dtype=ng.int16
weight_dtype=ng.int8
bias_dtype=ng.int32
scale_dtype=ng.int8
disable_fusion=False
onnx_filename='mnist-1.onnx'

dtypes = {}
ng.from_onnx(onnx_filename,
             value_dtypes=dtypes,
             default_placeholder_dtype=act_dtype,
             default_variable_dtype=weight_dtype,
             default_constant_dtype=weight_dtype,
             default_operator_dtype=act_dtype,
             default_scale_dtype=scale_dtype,
             default_bias_dtype=bias_dtype,
             disable_fusion=disable_fusion)

the output is:

Traceback (most recent call last):
  File "load_onnx.py", line 25, in <module>
    disable_fusion=disable_fusion)
  File "/home/u/tensorflow/nngen_try3/nngen/nngen/onnx/__init__.py", line 329, in from_onnx
    visitor.visit(name)
  File "/home/u/tensorflow/nngen_try3/nngen/nngen/onnx/__init__.py", line 147, in visit
    node_op = node_func(self, node)
  File "/home/u/tensorflow/nngen_try3/nngen/nngen/onnx/basic.py", line 89, in Add
    return _normalize_elementwise(method, None, visitor, node, np.add)
  File "/home/u/tensorflow/nngen_try3/nngen/nngen/onnx/basic.py", line 20, in _normalize_elementwise
    src_obj = visitor.visit(src)
  File "/home/u/tensorflow/nngen_try3/nngen/nngen/onnx/__init__.py", line 146, in visit
    node_func = _get_func(node.op_type)
  File "/home/u/tensorflow/nngen_try3/nngen/nngen/onnx/__init__.py", line 75, in _get_func
    return func_map[op_type]
KeyError: 'MatMul'

pbelecky avatar Nov 18 '20 17:11 pbelecky