场景:在 snpe 环境下,使用snpe-onnx-to-dlc
命令将输出的 onnx 模型转化为 dlc
问题:转化时会报错,内容如下
Traceback (most recent call last):
File "/home/panyihe/文档 /snpe-1.31.0.qnx/lib/python/snpe/converters/onnx/onnx_to_ir.py", line 129, in ir_optimize
op_graph_optimizations.apply_graph_optimizations(graph, self.disable_batchnorm_folding, **kwargs)
File "/home/panyihe/文档 /snpe-1.31.0.qnx/lib/python/snpe/converters/common/converter_ir/op_graph_optimizations.py", line 89, in apply_graph_optimizations
OptimizationTranslations.apply_method_to_all_ops(AXES_TO_SPATIAL_FIRST_ORDER, graph)
File "/home/panyihe/文档 /snpe-1.31.0.qnx/lib/python/snpe/converters/common/converter_ir/translation.py", line 74, in apply_method_to_all_ops
self.apply_method_to_op(node.op.type, method_name, node, graph, *args)
File "/home/panyihe/文档 /snpe-1.31.0.qnx/lib/python/snpe/converters/common/converter_ir/translation.py", line 55, in apply_method_to_op
return translation.apply_method(method_name, *args)
File "/home/panyihe/文档 /snpe-1.31.0.qnx/lib/python/snpe/converters/common/converter_ir/translation.py", line 17, in apply_method
return self.indexed_methods[method_name](*args)
File "/home/panyihe/文档 /snpe-1.31.0.qnx/lib/python/snpe/converters/common/converter_ir/op_graph_optimizations.py", line 943, in axes_to_spatial_first_order
if not node.op.keepdims:
File "/home/panyihe/文档 /snpe-1.31.0.qnx/lib/python/snpe/converters/common/converter_ir/op_adapter.py", line 39, in __getattr__
raise AttributeError("op %s has no attribute %s" % (self.name, name))
AttributeError: op reduce_mean_0 has no attribute keepdims
2020-05-11 16:27:58,360 - 165 - ERROR - op reduce_mean_0 has no attribute keepdims
这个问题网上差不多,因此不知道应该从哪个方向开始入手。想问问有没有高手给点修改意见,感谢不尽。
1
MekoPan OP 目前想法是 pytorch .pth 模型转 onnx 时有问题,因此导致 onnx 模型转 dlc 失败。
|
2
MekoPan OP 更新一下。目前暂时确定是 onnx 模型的问题,解决办法是修改了 snpe 中·op_graph_optimizations.py·和·axis_tracker.py·两个文件。dlc 模型成功输出。
|