aboutsummaryrefslogtreecommitdiff
path: root/delegate/test/ElementwiseBinaryTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'delegate/test/ElementwiseBinaryTest.cpp')
-rw-r--r--delegate/test/ElementwiseBinaryTest.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/delegate/test/ElementwiseBinaryTest.cpp b/delegate/test/ElementwiseBinaryTest.cpp
index effed03e5e..2f22e7d1b1 100644
--- a/delegate/test/ElementwiseBinaryTest.cpp
+++ b/delegate/test/ElementwiseBinaryTest.cpp
@@ -699,6 +699,50 @@ void SubFP32Test(std::vector<armnn::BackendId>& backends)
expectedOutputValues);
}
+void PowerFP32Test(std::vector<armnn::BackendId>& backends)
+{
+ std::vector<int32_t> input0Shape { 1, 1, 2, 2 };
+ std::vector<int32_t> input1Shape { 1, 1, 2, 2 };
+ std::vector<int32_t> expectedOutputShape { 1, 1, 2, 2 };
+
+ std::vector<float> input0Values = { 1, 3, 3, -7 };
+ std::vector<float> input1Values = { 1, 1, 0, 2 };
+ std::vector<float> expectedOutputValues = { 1, 3, 1, 49 };
+
+ ElementwiseBinaryTest<float>(tflite::BuiltinOperator_POW,
+ tflite::ActivationFunctionType_NONE,
+ ::tflite::TensorType_FLOAT32,
+ backends,
+ input0Shape,
+ input1Shape,
+ expectedOutputShape,
+ input0Values,
+ input1Values,
+ expectedOutputValues);
+}
+
+void SqDiffFP32Test(std::vector<armnn::BackendId>& backends)
+{
+ std::vector<int32_t> input0Shape { 1, 1, 2, 2 };
+ std::vector<int32_t> input1Shape { 1, 1, 2, 2 };
+ std::vector<int32_t> expectedOutputShape { 1, 1, 2, 2 };
+
+ std::vector<float> input0Values = { 1, 3, 3, -7 };
+ std::vector<float> input1Values = { 1, -1, 0, -2 };
+ std::vector<float> expectedOutputValues = { 0, 16, 9, 25 };
+
+ ElementwiseBinaryTest<float>(tflite::BuiltinOperator_SQUARED_DIFFERENCE,
+ tflite::ActivationFunctionType_NONE,
+ ::tflite::TensorType_FLOAT32,
+ backends,
+ input0Shape,
+ input1Shape,
+ expectedOutputShape,
+ input0Values,
+ input1Values,
+ expectedOutputValues);
+}
+
void SubBroadcastTest(std::vector<armnn::BackendId>& backends)
{
std::vector<int32_t> input0Shape { 1, 1, 2, 2 };
@@ -1131,6 +1175,18 @@ TEST_CASE ("SUB_UINT8_CpuRef_Test")
SubUint8Test(backends);
}
+TEST_CASE ("SqDiffFP32_CpuRef_Test")
+{
+ std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
+ SqDiffFP32Test(backends);
+}
+
+TEST_CASE ("PowerFP32_CpuRef_Test")
+{
+ std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
+ PowerFP32Test(backends);
+}
+
} // TEST_SUITE("ElementwiseBinary_CpuRefTests")
} // namespace armnnDelegate