在执行 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)
果不其然继续报错了,现在有点不知道怎么改了,网上也没相关信息。有没有熟悉这方面的老哥指点一二?