diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2021-10-21 14:05:31 +0100 |
---|---|---|
committer | Teresa Charlin <teresa.charlinreyes@arm.com> | 2021-10-27 20:54:21 +0100 |
commit | 2e5d0b2e2a212ceb803681b717cbaf821f5e0929 (patch) | |
tree | dd2364c8cd2845bd880191526a5eeb51eee7a2d4 /src/armnnDeserializer/test | |
parent | 65b86d4a42f3a55322d4bd4d8dccf6cf22775a30 (diff) | |
download | armnn-2e5d0b2e2a212ceb803681b717cbaf821f5e0929.tar.gz |
IVGCVSW-6469 Add MirrorPad FrontEnd and Ref Support
* Added PaddingMode enum to PaddingDescriptor to enable Symmetric and
Reflect padding.
* Added Symmetric and Reflect Ref implementation.
* Added Serializer & Deserializer support.
* Added unit tests.
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: I4bed907b31742b32ccefe5e8ca39a6f1e5bd9dee
Diffstat (limited to 'src/armnnDeserializer/test')
-rw-r--r-- | src/armnnDeserializer/test/DeserializePad.cpp | 119 |
1 files changed, 103 insertions, 16 deletions
diff --git a/src/armnnDeserializer/test/DeserializePad.cpp b/src/armnnDeserializer/test/DeserializePad.cpp index 43de22912f..ade097483c 100644 --- a/src/armnnDeserializer/test/DeserializePad.cpp +++ b/src/armnnDeserializer/test/DeserializePad.cpp @@ -12,10 +12,11 @@ TEST_SUITE("Deserializer_Pad") { struct PadFixture : public ParserFlatbuffersSerializeFixture { - explicit PadFixture(const std::string &inputShape, - const std::string &padList, - const std::string &outputShape, - const std::string &dataType) + explicit PadFixture(const std::string& inputShape, + const std::string& padList, + const std::string& outputShape, + const std::string& dataType, + const std::string& paddingMode) { m_JsonString = R"( { @@ -67,6 +68,7 @@ struct PadFixture : public ParserFlatbuffersSerializeFixture }, descriptor: { padList: )" + padList + R"(, + paddingMode: )" + paddingMode + R"(, } } }, @@ -106,23 +108,108 @@ struct SimplePadFixture : PadFixture SimplePadFixture() : PadFixture("[ 2, 2, 2 ]", "[ 0, 1, 2, 1, 2, 2 ]", "[ 3, 5, 6 ]", - "QuantisedAsymm8") {} + "QuantisedAsymm8", + "Constant") {} }; TEST_CASE_FIXTURE(SimplePadFixture, "SimplePadQuantisedAsymm8") { RunTest<3, armnn::DataType::QAsymmU8>(0, - { - 0, 4, 2, 5, 6, 1, 5, 2 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, - 1, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }); + { + 0, 4, 2, 5, 6, 1, 5, 2 + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, + 1, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }); +} + +struct SimplePadSymmetricFixture : PadFixture +{ + SimplePadSymmetricFixture() : PadFixture("[ 2, 2, 2 ]", + "[ 1, 1, 1, 1, 1, 1 ]", + "[ 4, 4, 4 ]", + "QuantisedAsymm8", + "Symmetric") {} +}; + +TEST_CASE_FIXTURE(SimplePadSymmetricFixture, "SimplePadSymmetricQuantisedAsymm8") +{ + RunTest<3, armnn::DataType::QAsymmU8>(0, + { + 1, 2, + 3, 4, + + 5, 6, + 7, 8 + }, + { + 1, 1, 2, 2, + 1, 1, 2, 2, + 3, 3, 4, 4, + 3, 3, 4, 4, + + 1, 1, 2, 2, + 1, 1, 2, 2, + 3, 3, 4, 4, + 3, 3, 4, 4, + + 5, 5, 6, 6, + 5, 5, 6, 6, + 7, 7, 8, 8, + 7, 7, 8, 8, + + 5, 5, 6, 6, + 5, 5, 6, 6, + 7, 7, 8, 8, + 7, 7, 8, 8 + }); +} + +struct SimplePadReflectFixture : PadFixture +{ + SimplePadReflectFixture() : PadFixture("[ 2, 2, 2 ]", + "[ 1, 1, 1, 1, 1, 1 ]", + "[ 4, 4, 4 ]", + "QuantisedAsymm8", + "Reflect") {} +}; + +TEST_CASE_FIXTURE(SimplePadReflectFixture, "SimplePadReflectQuantisedAsymm8") +{ + RunTest<3, armnn::DataType::QAsymmU8>(0, + { + 1, 2, + 3, 4, + + 5, 6, + 7, 8 + }, + { + 8, 7, 8, 7, + 6, 5, 6, 5, + 8, 7, 8, 7, + 6, 5, 6, 5, + + 4, 3, 4, 3, + 2, 1, 2, 1, + 4, 3, 4, 3, + 2, 1, 2, 1, + + 8, 7, 8, 7, + 6, 5, 6, 5, + 8, 7, 8, 7, + 6, 5, 6, 5, + + 4, 3, 4, 3, + 2, 1, 2, 1, + 4, 3, 4, 3, + 2, 1, 2, 1 + }); } } |