From 3b3dcbf0321fadcb2b7b5b550a4d03f510d7cb7b Mon Sep 17 00:00:00 2001 From: Cian McGriskin Date: Wed, 26 Jul 2023 11:52:47 +0100 Subject: IVGCVSW-2291 TILE Operator CL Implementation * Added Tile Operator Implementation to CL * Added calls to the existing UnitTests * Added Documentation Signed-off-by: Cian McGriskin Change-Id: If7d25c7aa669c24e7816e5d445c7a3b9ce6972d4 --- .../backendsCommon/test/TileEndToEndTestImpl.hpp | 18 +++---- .../test/layerTests/TileTestImpl.cpp | 56 +++++++++++++--------- 2 files changed, 43 insertions(+), 31 deletions(-) (limited to 'src/backends/backendsCommon/test') diff --git a/src/backends/backendsCommon/test/TileEndToEndTestImpl.hpp b/src/backends/backendsCommon/test/TileEndToEndTestImpl.hpp index 4047e5ad8e..03b76849e1 100644 --- a/src/backends/backendsCommon/test/TileEndToEndTestImpl.hpp +++ b/src/backends/backendsCommon/test/TileEndToEndTestImpl.hpp @@ -32,25 +32,25 @@ void TileEndToEnd(const std::vector& backends) int32_t qOffset = 0; bool qConst = true; - const TensorShape inputTensorShape = { 2, 3 }; - const TensorShape outputTensorShape = { 4, 6 }; + const TensorShape inputTensorShape = { 6 }; + const TensorShape outputTensorShape = { 30 }; TensorInfo inputInfo (inputTensorShape, ArmnnType, qScale, qOffset, qConst); TensorInfo outputInfo (outputTensorShape, ArmnnType,qScale, qOffset); std::vector inputData = armnnUtils::QuantizedVector({ - 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f + 65, 144, 91, 161, 56, 73 }, qScale, qOffset); std::vector expectedOutputData = armnnUtils::QuantizedVector({ - 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, - 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f, 3.f, 4.f, 5.f + 65, 144, 91, 161, 56, 73, + 65, 144, 91, 161, 56, 73, + 65, 144, 91, 161, 56, 73, + 65, 144, 91, 161, 56, 73, + 65, 144, 91, 161, 56, 73 }, qScale, qOffset); - auto descriptor = armnn::TileDescriptor(std::vector{ 2, 2 }); + auto descriptor = armnn::TileDescriptor(std::vector{ 5 }); INetworkPtr network = CreateTileNetwork(descriptor, inputInfo, outputInfo); std::map> inputTensor = { { 0, inputData } }; diff --git a/src/backends/backendsCommon/test/layerTests/TileTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/TileTestImpl.cpp index 0b13bba425..c61da26bb2 100644 --- a/src/backends/backendsCommon/test/layerTests/TileTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/TileTestImpl.cpp @@ -110,13 +110,13 @@ LayerTestResult Tile2dTest(armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::ITensorHandleFactory& tensorHandleFactory) { - auto descriptor = armnn::TileDescriptor(std::vector{ 2, 2 }); + auto descriptor = armnn::TileDescriptor(std::vector{ 2, 5 }); float qScale = 1.0f; int32_t qOffset = 0; armnn::TensorShape inputShape = { 2, 3 }; - armnn::TensorShape outputShape = { 4, 6 }; + armnn::TensorShape outputShape = { 4, 15 }; armnn::TensorInfo inputInfo(inputShape, ArmnnType); armnn::TensorInfo outputInfo(outputShape, ArmnnType); @@ -130,11 +130,11 @@ LayerTestResult Tile2dTest(armnn::IWorkloadFactory& workloadFactory, std::vector expectedOutput = armnnUtils::QuantizedVector( { - 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, + 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, + 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, - 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f, 3.f, 4.f, 5.f + 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, 0.f, 1.f, 2.f, + 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, 3.f, 4.f, 5.f, 3.f, 4.f, 5.f }, qScale, qOffset); return TileTestImpl(workloadFactory, @@ -152,37 +152,49 @@ LayerTestResult Tile3dTest(armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::ITensorHandleFactory& tensorHandleFactory) { - auto descriptor = armnn::TileDescriptor(std::vector{ 1, 2, 1 }); + auto descriptor = armnn::TileDescriptor(std::vector{ 1, 5, 5 }); float qScale = 1.0f; int32_t qOffset = 0; - armnn::TensorShape inputShape = { 2, 2, 3 }; - armnn::TensorShape outputShape = { 2, 4, 3 }; + armnn::TensorShape inputShape = { 2, 2, 2 }; + armnn::TensorShape outputShape = { 2, 10, 10 }; armnn::TensorInfo inputInfo(inputShape, ArmnnType); armnn::TensorInfo outputInfo(outputShape, ArmnnType); std::vector input = armnnUtils::QuantizedVector( { - 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f, + 1.1f, 2.12f, + 3.3f, 4.12234f, - 6.f, 7.f, 8.f, - 9.f, 10.f, 11.f + 1.1f, 2.12f, + 3.3f, 4.12234f, }, qScale, qOffset); std::vector expectedOutput = armnnUtils::QuantizedVector( { - 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f, - 0.f, 1.f, 2.f, - 3.f, 4.f, 5.f, - - 6.f, 7.f, 8.f, - 9.f, 10.f, 11.f, - 6.f, 7.f, 8.f, - 9.f, 10.f, 11.f + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, + 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, 1.1f, 2.12f, + 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f, 3.3f, 4.12234f }, qScale, qOffset); return TileTestImpl(workloadFactory, -- cgit v1.2.1