Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onnx convert_conv2d problems #768

Open
realdartagnan opened this issue Apr 24, 2022 · 1 comment
Open

onnx convert_conv2d problems #768

realdartagnan opened this issue Apr 24, 2022 · 1 comment

Comments

@realdartagnan
Copy link

将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中,导致报错。请问这个符合预期吗?

@pengfeidip
Copy link

我也出现了类似的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants