aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test
diff options
context:
space:
mode:
authorJames Conroy <james.conroy@arm.com>2018-10-03 09:32:03 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2018-10-10 16:16:58 +0100
commit074f371bcd1d91c1f36b458d9ea1b050eafe5947 (patch)
tree2063f84b6e89aa112ec997c09b829ff087da4abb /src/armnn/test
parent5eec11db435a94ba5046ba74edc5c9c412a64e9d (diff)
downloadarmnn-074f371bcd1d91c1f36b458d9ea1b050eafe5947.tar.gz
IVGCVSW-1932: Add Unit tests for NHWC ResizeBilinear
* Adds five unit tests that execute ResizeBilinear with the NHWC data layout and Float32 data type. * Refactors original ResizeBilinear Float32 tests to take DataLayout as a parameter. * Adds four unit tests that execute CreateWorkloadCl for both NCHW and NHWC (NCHW tests did not exist for CreateWorkloadCl). Change-Id: I1af419ed0b62b8f4d4550f6d120a584a0a223b17
Diffstat (limited to 'src/armnn/test')
-rw-r--r--src/armnn/test/CreateWorkload.hpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/armnn/test/CreateWorkload.hpp b/src/armnn/test/CreateWorkload.hpp
index 66f62820d9..f2c8b5a20a 100644
--- a/src/armnn/test/CreateWorkload.hpp
+++ b/src/armnn/test/CreateWorkload.hpp
@@ -807,13 +807,33 @@ void CreateSplitterMultipleInputsOneOutputWorkloadTest(armnn::IWorkloadFactory&
template <typename ResizeBilinearWorkload, armnn::DataType DataType>
std::unique_ptr<ResizeBilinearWorkload> CreateResizeBilinearWorkloadTest(armnn::IWorkloadFactory& factory,
- armnn::Graph& graph)
+ armnn::Graph& graph,
+ DataLayout dataLayout = DataLayout::NCHW)
{
+ TensorShape inputShape;
+ TensorShape outputShape;
+ unsigned int heightIndex;
+ unsigned int widthIndex;
+
+ switch (dataLayout) {
+ case DataLayout::NHWC:
+ inputShape = { 2, 4, 4, 3 };
+ outputShape = { 2, 2, 2, 3 };
+ heightIndex = 1;
+ widthIndex = 2;
+ break;
+ default: // NCHW
+ inputShape = { 2, 3, 4, 4 };
+ outputShape = { 2, 3, 2, 2 };
+ heightIndex = 2;
+ widthIndex = 3;
+ }
+
// Creates the layer we're testing.
- TensorShape outputShape({ 2, 3, 2, 2 });
ResizeBilinearDescriptor resizeDesc;
- resizeDesc.m_TargetWidth = outputShape[3];
- resizeDesc.m_TargetHeight = outputShape[2];
+ resizeDesc.m_TargetWidth = outputShape[widthIndex];
+ resizeDesc.m_TargetHeight = outputShape[heightIndex];
+ resizeDesc.m_DataLayout = dataLayout;
Layer* const layer = graph.AddLayer<ResizeBilinearLayer>(resizeDesc, "layer");
// Creates extra layers.
@@ -821,7 +841,7 @@ std::unique_ptr<ResizeBilinearWorkload> CreateResizeBilinearWorkloadTest(armnn::
Layer* const output = graph.AddLayer<OutputLayer>(0, "output");
// Connects up.
- armnn::TensorInfo inputTensorInfo({ 2, 3, 4, 4 }, DataType);
+ armnn::TensorInfo inputTensorInfo(inputShape, DataType);
armnn::TensorInfo outputTensorInfo(outputShape, DataType);
Connect(input, layer, inputTensorInfo);
Connect(layer, output, outputTensorInfo);
@@ -833,6 +853,7 @@ std::unique_ptr<ResizeBilinearWorkload> CreateResizeBilinearWorkloadTest(armnn::
ResizeBilinearQueueDescriptor queueDescriptor = workload->GetData();
BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
+ BOOST_TEST((queueDescriptor.m_Parameters.m_DataLayout == dataLayout));
// Returns so we can do extra, backend-specific tests.
return workload;