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

cpu后端binary算子使用的函数选择器不合理 #2691

Closed
shine-xia opened this issue Dec 11, 2023 · 1 comment
Closed

cpu后端binary算子使用的函数选择器不合理 #2691

shine-xia opened this issue Dec 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@shine-xia
Copy link

shine-xia commented Dec 11, 2023

Platform(Include target platform as well if cross-compiling):

Linux x86_64

Github Version:

commit id 94e1212
tag 2.7.1

问题描述

source/backend/cpu/CPURaster.cpp, line 973左右
此处代码,根据outputType.code的不同,选择使用MNNSelectBinaryFunctionForFloat或者selectForInt进行计算函数的选择
但是实际上,如果某个binary算子,2个输入tensor是float类型,输出tensor是int类型,那么真正应该选择的函数是float类型的计算函数而非int类型的计算函数。
举例,对BinaryOpOperation_GREATER_EQUAL类型的op,int/float算子分别为

return execute<int32_t, int32_t, BinaryGreaterEqual<int32_t, int32_t, int32_t>>;

return execute<float, int32_t, BinaryGreaterEqual<float, float, int32_t>>;

建议

source/backend/cpu/CPURaster.cpp, line 973左右的逻辑,从判断outputType选择不同的计算函数,改为判断inputType选择不同的计算函数。

@jxt1234 jxt1234 added the bug Something isn't working label Jan 6, 2024
@jxt1234
Copy link
Collaborator

jxt1234 commented Jan 6, 2024

2.8.1 已经按建议修改

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants