aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures/LogicalFixture.h
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-11-13 13:44:13 +0000
committerSang-Hoon Park <sang-hoon.park@arm.com>2020-11-18 12:25:16 +0000
commit75eea338eb232ebdafa2fb84d22e711b5f964785 (patch)
treed069d26864c3ae180ff526262a1436af839a5bb0 /tests/validation/fixtures/LogicalFixture.h
parent10a73f5c0cc15ffba532bc923c6471f67af0959a (diff)
downloadComputeLibrary-75eea338eb232ebdafa2fb84d22e711b5f964785.tar.gz
COMPMID-3961: Add Logical OR/AND/NOT operator on CL
Change-Id: I612aeed6affa17624fb9044964dd59c41a5c9888 Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4448 Reviewed-by: Pablo Marquez Tello <pablo.tello@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/fixtures/LogicalFixture.h')
-rw-r--r--tests/validation/fixtures/LogicalFixture.h37
1 files changed, 17 insertions, 20 deletions
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 <typename U>
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<uint8_t> { zero, one, zero, one, mixed, zero, mixed } :
@@ -70,7 +70,10 @@ protected:
SimpleTensor<T> _reference{};
};
-template <typename TensorType, typename AccessorType, typename FunctionType, reference::LogicalBinaryOperation Op, typename T>
+template <typename T>
+using LogicalBinaryRefFunctionPtrType = SimpleTensor<T>(const SimpleTensor<T> &, const SimpleTensor<T> &);
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T, LogicalBinaryRefFunctionPtrType<T> RefFunction>
class LogicalBinaryOperationValidationFixture : public LogicalOperationValidationFixtureBase<TensorType, AccessorType, FunctionType, T>
{
using Parent = LogicalOperationValidationFixtureBase<TensorType, AccessorType, FunctionType, T>;
@@ -114,25 +117,19 @@ private:
Parent::fill(src0, 0);
Parent::fill(src1, 1);
- switch(Op)
- {
- case reference::LogicalBinaryOperation::OR:
- return reference::logical_or<T>(src0, src1);
- case reference::LogicalBinaryOperation::AND:
- return reference::logical_and<T>(src0, src1);
- case reference::LogicalBinaryOperation::UNKNOWN:
- /* fall-through */
- default:
- ARM_COMPUTE_ASSERT_FAIL("unknown logical binary operator is given");
- }
-
- return SimpleTensor<T> {};
+ return RefFunction(src0, src1);
}
- static constexpr auto _data_type{ DataType::U8 };
+ static constexpr auto _data_type = DataType::U8;
};
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+using LogicalOrValidationFixture = LogicalBinaryOperationValidationFixture<TensorType, AccessorType, FunctionType, T, &reference::logical_or<T>>;
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+using LogicalAndValidationFixture = LogicalBinaryOperationValidationFixture<TensorType, AccessorType, FunctionType, T, &reference::logical_and<T>>;
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
class LogicalNotValidationFixture : public LogicalOperationValidationFixtureBase<TensorType, AccessorType, FunctionType, T>
{
using Parent = LogicalOperationValidationFixtureBase<TensorType, AccessorType, FunctionType, T>;
@@ -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 */