IVGCVSW-7451 LEAKY_RELU not supported by delegate
* Added LEAKY_RELU support to classic and opaque delegate
* CMake files updated
* Test added
Signed-off-by: Tianle Cheng <tianle.cheng@arm.com>
Change-Id: Ib9a2ce8f637b14afcd796bbae11fd3fa03653a2c
diff --git a/delegate/test/ActivationTest.cpp b/delegate/test/ActivationTest.cpp
index 8f2f198..620c299 100644
--- a/delegate/test/ActivationTest.cpp
+++ b/delegate/test/ActivationTest.cpp
@@ -170,6 +170,32 @@
outputExpectedData);
}
+void ActivationLeakyReLuTest(std::vector<armnn::BackendId>& backends)
+{
+ std::vector<float> inputData = {
+ -0.1f, -0.2f, -0.3f, -0.4f,
+ 0.1f, 0.2f, 0.3f, 0.4f,
+ -1.0f, -2.0f, -3.0f, -4.0f,
+ 1.0f, 2.0f, 3.0f, 4.0f
+ };
+
+ float alpha = 0.3f;
+
+ // Calculate output values for input.
+ auto f = [alpha](float value)
+ {
+ return value > 0 ? value : value * alpha;
+ };
+ std::vector<float> outputExpectedData(inputData.size());
+ std::transform(inputData.begin(), inputData.end(), outputExpectedData.begin(), f);
+
+ ActivationTest(tflite::BuiltinOperator_LEAKY_RELU,
+ backends,
+ inputData,
+ outputExpectedData,
+ alpha);
+}
+
TEST_SUITE("Activation_CpuRefTests")
{
@@ -209,6 +235,12 @@
ActivationHardSwishTest(backends);
}
+TEST_CASE ("Activation_LeakyRelu_CpuRef_Test")
+{
+ std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
+ ActivationLeakyReLuTest(backends);
+}
+
}
TEST_SUITE("Activation_CpuAccTests")
@@ -250,6 +282,12 @@
ActivationHardSwishTest(backends);
}
+TEST_CASE ("Activation_LeakyRelu_CpuAcc_Test")
+{
+ std::vector<armnn::BackendId> backends = { armnn::Compute::CpuAcc };
+ ActivationLeakyReLuTest(backends);
+}
+
}
TEST_SUITE("Activation_GpuAccTests")
@@ -291,6 +329,12 @@
ActivationHardSwishTest(backends);
}
+TEST_CASE ("Activation_LeakyRelu_GpuAcc_Test")
+{
+ std::vector<armnn::BackendId> backends = { armnn::Compute::GpuAcc };
+ ActivationLeakyReLuTest(backends);
+}
+
}
} // namespace armnnDelegate
\ No newline at end of file