We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 resize op转换成tengine interp op之后tengine interp op attributes数值不正确。
待转换的onnx模型:
转换后的tengine interp op attributes:
可以发现转换后的tengine interp op的output_width与width_scale均出现错误。预期的output_width是20,而预期的width_scale是2。
output_width
width_scale
python == 3.8.12 pytorch == 1.10.0 tengine: https://github.com/OAID/Tengine/commit/91db3706e772568e022fcfcbef66d1998251988f
resize 模型导出代码:
import torch import torch.nn as nn class MyModule(torch.nn.Module): def __init__(self) -> None: super().__init__() self.resize = nn.Upsample(scale_factor=2, mode='nearest') def forward(self, x): return self.resize(x) model = MyModule() torch.onnx.export( model, torch.randn((1, 3, 10, 10)), './toy.onnx', input_names=['input'], output_names=["output"], opset_version=10 )
经过debug发现在onnx2tengine的load_graph_node的load_resize步骤中正确写入了height_scale与width_scale。
load_graph_node
load_resize
Tengine/tools/convert_tool/onnx/onnx2tengine.cpp
Lines 2123 to 2131 in 91db370
但是在后续的optimize_graph的interp infer_shape环节再次读取op.param_mem发现其中的width_scale数据就出现异常。
optimize_graph
op.param_mem
所以推测在load_graph_node到optimize_graph之间某些操作影响到了interp op param_mem中的width_scale数据。
The text was updated successfully, but these errors were encountered:
这不是tengine的bug,是netron的bug,lutzroeder/netron#973 已经修了。
Sorry, something went wrong.
No branches or pull requests
错误描述
将onnx resize op转换成tengine interp op之后tengine interp op attributes数值不正确。
待转换的onnx模型:
![image](https://user-images.githubusercontent.com/8266614/145974377-da9ef98e-25da-4a71-9208-601ef3a07fbb.png)
转换后的tengine interp op attributes:
![image](https://user-images.githubusercontent.com/8266614/145974556-9cd39dfe-c3ba-4b82-8343-d84349f8603f.png)
可以发现转换后的tengine interp op的
output_width
与width_scale
均出现错误。预期的output_width
是20,而预期的width_scale
是2。环境
相关代码
resize 模型导出代码:
分析
经过debug发现在onnx2tengine的
load_graph_node
的load_resize
步骤中正确写入了height_scale与width_scale。Tengine/tools/convert_tool/onnx/onnx2tengine.cpp
Lines 2123 to 2131 in 91db370
但是在后续的
optimize_graph
的interp infer_shape环节再次读取op.param_mem
发现其中的width_scale数据就出现异常。所以推测在
load_graph_node
到optimize_graph
之间某些操作影响到了interp op param_mem中的width_scale数据。The text was updated successfully, but these errors were encountered: