Skip to content

Commit

Permalink
Fix bug for binary not equal float not imp
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaying committed Apr 19, 2024
1 parent 5895243 commit 8ba2c49
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions source/backend/cpu/CPUBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ MNNBinaryExecute CPUBinary::selectForFloat(int type) {
return execute<float, float, BinaryFloorDiv<float, float, float>>;
case BinaryOpOperation_FLOORMOD:
return execute<float, float, BinaryFloorMod<float, float, float>>;
case BinaryOpOperation_NOTEQUAL:
return execute<float, int32_t, BinaryNotEqual<float, float, int32_t>>;
case BinaryOpOperation_POW:
return execute<float, float, BinaryPow<float, float, float>>;
case BinaryOpOperation_ATAN2:
Expand Down
26 changes: 23 additions & 3 deletions test/op/BinaryOPTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, int>(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 {
Expand All @@ -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<int, int>(_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 {
Expand Down Expand Up @@ -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<float, int>(_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 {
Expand Down

0 comments on commit 8ba2c49

Please sign in to comment.