在执行 snpe-onnx-to-dlc 命令时报错
AttributeError: op reduce_mean_0 has no attribute keepdims
原因好像是跟 keepdims 属性有关,对于 keepdims 这个属性我不太熟悉,于是我进行了以下处理:
old:
if input_buf.axis_format in format_to_permute_order:
target_format = format_to_format[input_buf.axis_format]
permute_order = format_to_permute_order[input_buf.axis_format]
# If keep dims = 0 we must permute as it will remove dimensions
if not node.op.keepdims:
AxisTracker.inject_implicit_permute(graph, input_name, target_format,
permute_order, [node.op.name])
output_buf.axis_format = AxisTracker.AxisFormat.NONTRIVIAL
else:
AxisTracker.eltwise_to_spatial_first_order(node, graph)
new:
if input_buf.axis_format in format_to_permute_order:
target_format = format_to_format[input_buf.axis_format]
permute_order = format_to_permute_order[input_buf.axis_format]
# If keep dims = 0 we must permute as it will remove dimensions
if not hasattr(node.op, "keepdims"):
AxisTracker.inject_implicit_permute(graph, input_name, target_format,
permute_order, [node.op.name])
output_buf.axis_format = AxisTracker.AxisFormat.NONTRIVIAL
else:
AxisTracker.eltwise_to_spatial_first_order(node, graph)
果不其然继续报错了,现在有点不知道怎么改了,网上也没相关信息。有没有熟悉这方面的老哥指点一二?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.