From 4a4af11f2e02465df8f5aa2b2de19d00c2a8ea3d Mon Sep 17 00:00:00 2001 From: Narumol Prangnawarat Date: Tue, 25 May 2021 14:26:24 +0100 Subject: IVGCVSW-3649 Add Prelu with different alpha dimension test to TfLiteParser Signed-off-by: Narumol Prangnawarat Change-Id: I982ecd66ea3ed4d88934cd8254832eecb4a7adb4 --- src/armnnTfLiteParser/test/Prelu.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/armnnTfLiteParser') diff --git a/src/armnnTfLiteParser/test/Prelu.cpp b/src/armnnTfLiteParser/test/Prelu.cpp index b4aa8d7f4d..48a86dcefc 100644 --- a/src/armnnTfLiteParser/test/Prelu.cpp +++ b/src/armnnTfLiteParser/test/Prelu.cpp @@ -106,7 +106,7 @@ struct PreluFixture : public ParserFlatbuffersFixture struct SimplePreluFixture : PreluFixture { SimplePreluFixture() : PreluFixture("[ 2, 3 ]", - "[ 1, 1 ]", + "[ 1 ]", "[ 2, 3 ]", "[ 0, 1 ]", "") {} @@ -115,13 +115,23 @@ struct SimplePreluFixture : PreluFixture struct PreluConstAlphaFixture : PreluFixture { PreluConstAlphaFixture() : PreluFixture( - "[ 2, 3 ]", - "[ 2, 3 ]", - "[ 2, 3 ]", + "[ 1, 2, 3 ]", + "[ 1, 2, 3 ]", + "[ 1, 2, 3 ]", "[ 0 ]", "\"data\": [ 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62 ]"){} }; +struct PreluBroadcastAlphaFixture : PreluFixture +{ + PreluBroadcastAlphaFixture() : PreluFixture( + "[ 1, 1, 2, 3 ]", + "[ 1, 3 ]", + "[ 1, 1, 2, 3 ]", + "[ 0 ]", + "\"data\": [ 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62 ]"){} +}; + struct PreluDynamicTensorFixture : PreluFixture { PreluDynamicTensorFixture() : PreluFixture("[ 2, 3 ]", @@ -141,7 +151,15 @@ BOOST_FIXTURE_TEST_CASE(SimplePrelu, SimplePreluFixture) BOOST_FIXTURE_TEST_CASE(PreluConstAlpha, PreluConstAlphaFixture) { - RunTest<2, armnn::DataType::Float32>( + RunTest<3, armnn::DataType::Float32>( + 0, + {{"input0", { -14.f, 2.f, 0.f, 1.f, -5.f, 14.f }}}, + {{"output", { -3.5f, 2.f, 0.f, 1.f, -1.25f, 14.f }}}); +} + +BOOST_FIXTURE_TEST_CASE(PreluBroadcastAlpha, PreluBroadcastAlphaFixture) +{ + RunTest<4, armnn::DataType::Float32>( 0, {{"input0", { -14.f, 2.f, 0.f, 1.f, -5.f, 14.f }}}, {{"output", { -3.5f, 2.f, 0.f, 1.f, -1.25f, 14.f }}}); -- cgit v1.2.1