From 75eea338eb232ebdafa2fb84d22e711b5f964785 Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Fri, 13 Nov 2020 13:44:13 +0000 Subject: COMPMID-3961: Add Logical OR/AND/NOT operator on CL Change-Id: I612aeed6affa17624fb9044964dd59c41a5c9888 Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4448 Reviewed-by: Pablo Marquez Tello Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- tests/validation/fixtures/LogicalFixture.h | 37 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'tests/validation/fixtures/LogicalFixture.h') diff --git a/tests/validation/fixtures/LogicalFixture.h b/tests/validation/fixtures/LogicalFixture.h index a4817cf785..4bedb378bb 100644 --- a/tests/validation/fixtures/LogicalFixture.h +++ b/tests/validation/fixtures/LogicalFixture.h @@ -46,10 +46,10 @@ protected: template void fill(U &&tensor, int i) { - constexpr uint8_t zero = 0; - constexpr uint8_t one = 0x1; - constexpr uint8_t mixed = 0xAA; - constexpr uint8_t mixed_bitwise_not = ~(0xAA); + constexpr auto zero = (uint8_t)0; + constexpr auto one = (uint8_t)0x1; + constexpr auto mixed = (uint8_t)0xAA; + constexpr auto mixed_bitwise_not = (uint8_t) ~(0xAA); library->fill_static_values(tensor, i == 0 ? std::vector { zero, one, zero, one, mixed, zero, mixed } : @@ -70,7 +70,10 @@ protected: SimpleTensor _reference{}; }; -template +template +using LogicalBinaryRefFunctionPtrType = SimpleTensor(const SimpleTensor &, const SimpleTensor &); + +template RefFunction> class LogicalBinaryOperationValidationFixture : public LogicalOperationValidationFixtureBase { using Parent = LogicalOperationValidationFixtureBase; @@ -114,24 +117,18 @@ private: Parent::fill(src0, 0); Parent::fill(src1, 1); - switch(Op) - { - case reference::LogicalBinaryOperation::OR: - return reference::logical_or(src0, src1); - case reference::LogicalBinaryOperation::AND: - return reference::logical_and(src0, src1); - case reference::LogicalBinaryOperation::UNKNOWN: - /* fall-through */ - default: - ARM_COMPUTE_ASSERT_FAIL("unknown logical binary operator is given"); - } - - return SimpleTensor {}; + return RefFunction(src0, src1); } - static constexpr auto _data_type{ DataType::U8 }; + static constexpr auto _data_type = DataType::U8; }; +template +using LogicalOrValidationFixture = LogicalBinaryOperationValidationFixture>; + +template +using LogicalAndValidationFixture = LogicalBinaryOperationValidationFixture>; + template class LogicalNotValidationFixture : public LogicalOperationValidationFixtureBase { @@ -178,4 +175,4 @@ private: } // namespace validation } // namespace test } // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_LOGICAL_FIXTURE */ \ No newline at end of file +#endif /* ARM_COMPUTE_TEST_LOGICAL_FIXTURE */ -- cgit v1.2.1