mace icon indicating copy to clipboard operation
mace copied to clipboard

onnx convert_conv2d problems

Open realdartagnan opened this issue 2 years ago • 1 comments

将onnx模型转mace models时,一个conv op转换失败,报错如下: Traceback (most recent call last): File "tools/converter.py", line 1334, in flags.func(flags) File "tools/converter.py", line 926, in convert_func convert.convert(configs, MODEL_CODEGEN_DIR, flags.enable_micro) File "tools/python/convert.py", line 89, in convert net_def_with_Data = convert_net(net_name, net_conf, enable_micro) File "tools/python/convert.py", line 235, in convert_net output_graph_def, converter_info = converter.run() File "tools/python/transform/onnx_converter.py", line 565, in run self.convert_ops(graph_def) File "tools/python/transform/onnx_converter.py", line 649, in convert_ops self._op_convertersnode.op_type File "tools/python/transform/onnx_converter.py", line 937, in convert_conv2d filter_shape = self._graph_shapes_dict[node.inputs[1]] KeyError: '819' 而其中,这个op打印如下: { input: "540" input: "819" input: "820" output: "818" name: "Conv_12" op_type: "Conv" attribute { name: "dilations" ints: 1 ints: 1 type: INTS } attribute { name: "group" i: 32 type: INT } attribute { name: "kernel_shape" ints: 3 ints: 3 type: INTS } attribute { name: "pads" ints: 1 ints: 1 ints: 1 ints: 1 type: INTS } attribute { name: "strides" ints: 2 ints: 2 type: INTS } } 顺着代码看了下,报错那行代码中试图从self._graph_shapes_dict中读取shape,这个self._graph_shapes_dict是通过读取图中tensor得到的,可819号其实是参数W,所以没有出现在self._graph_shapes_dict中,导致报错。请问这个符合预期吗?

realdartagnan avatar Apr 24 '22 16:04 realdartagnan

我也出现了类似的问题

pengfeidip avatar May 27 '22 10:05 pengfeidip