From 8ba2c49380de588e534259695b00b6a889d16a8c Mon Sep 17 00:00:00 2001 From: xiaying Date: Fri, 19 Apr 2024 12:54:03 +0800 Subject: [PATCH] Fix bug for binary not equal float not imp --- source/backend/cpu/CPUBinary.cpp | 2 ++ test/op/BinaryOPTest.cpp | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/source/backend/cpu/CPUBinary.cpp b/source/backend/cpu/CPUBinary.cpp index 92319bcbd..953bbb7d0 100644 --- a/source/backend/cpu/CPUBinary.cpp +++ b/source/backend/cpu/CPUBinary.cpp @@ -105,6 +105,8 @@ MNNBinaryExecute CPUBinary::selectForFloat(int type) { return execute>; case BinaryOpOperation_FLOORMOD: return execute>; + case BinaryOpOperation_NOTEQUAL: + return execute>; case BinaryOpOperation_POW: return execute>; case BinaryOpOperation_ATAN2: diff --git a/test/op/BinaryOPTest.cpp b/test/op/BinaryOPTest.cpp index 8a6a12387..44ec301a5 100644 --- a/test/op/BinaryOPTest.cpp +++ b/test/op/BinaryOPTest.cpp @@ -464,7 +464,13 @@ class EqualTest : public BinaryTestCommon { {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}, {3.0, 4.0}, {0, 0, 1, 1, 0, 0, 0, 0}, - {4, 2}, {2}, {4, 2}); + {4, 2}, {2}, {4, 2}) && + test(MNN::Express::_Equal, "EqualIntTest", 0, + {1, 2, 3, 4, 5, 6, 7, 8}, + {3, 4}, + {0, 0, 1, 1, 0, 0, 0, 0}, + {4, 2}, {2}, {4, 2}); + ; } }; class LessEqualTest : public BinaryTestCommon { @@ -475,7 +481,14 @@ class LessEqualTest : public BinaryTestCommon { {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}, {3.0, 4.0}, {1, 1, 1, 1, 0, 0, 0, 0}, - {4, 2}, {2}, {4, 2}); + {4, 2}, {2}, {4, 2}) + && + test(_LessEqual, "LessEqualIntTest", 0, + {1, 2, 3, 4, 5, 6, 7, 8}, + {3, 4}, + {1, 1, 1, 1, 0, 0, 0, 0}, + {4, 2}, {2}, {4, 2}) + ; } }; class FloorModTest : public BinaryTestCommon { @@ -539,7 +552,14 @@ class NotEqualTest : public BinaryTestCommon { {true, false, true, false, false, true, true, false}, {true, false}, {false, false, false, false, true, true, false, false}, - {4, 2}, {2}, {4, 2}); + {4, 2}, {2}, {4, 2}) + && + test(_NotEqual, "NotEqualTest", 0, + {1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0}, + {1.0, 0.0}, + {false, false, false, false, true, true, false, false}, + {4, 2}, {2}, {4, 2}) + ; } }; class BitwiseAndTest : public BinaryTestCommon {