aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp')
-rw-r--r--src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp78
1 files changed, 46 insertions, 32 deletions
diff --git a/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp
index 38df285920..9d539975c7 100644
--- a/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp
+++ b/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp
@@ -29,6 +29,7 @@ template<armnn::DataType ArmnnType,
LayerTestResult<T, OutputDim> BatchToSpaceNdHelper(
armnn::IWorkloadFactory &workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory,
const armnn::DataLayout& dataLayout,
const unsigned int *inputShape,
const std::vector<float> &inputData,
@@ -56,10 +57,8 @@ LayerTestResult<T, OutputDim> BatchToSpaceNdHelper(
result.outputExpected = MakeTensor<T, OutputDim>(outputTensorInfo,
ConvertToDataType<ArmnnType>(outputData, outputTensorInfo));
- ARMNN_NO_DEPRECATE_WARN_BEGIN
- std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
- ARMNN_NO_DEPRECATE_WARN_END
+ std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo);
+ std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo);
armnn::BatchToSpaceNdQueueDescriptor data;
data.m_Parameters.m_DataLayout = dataLayout;
@@ -89,7 +88,8 @@ LayerTestResult<T, OutputDim> BatchToSpaceNdHelper(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNhwcTest1(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 2, 2, 1};
const unsigned int outputShape[] = {1, 4, 4, 1};
@@ -128,7 +128,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest1(
std::vector<unsigned int> blockShape {2, 2};
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NHWC, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -136,7 +136,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest1(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNhwcTest2(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 1, 1, 1};
const unsigned int outputShape[] = {1, 2, 2, 1};
@@ -151,7 +152,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest2(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NHWC, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -159,7 +160,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest2(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNhwcTest3(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 1, 1, 3};
const unsigned int outputShape[] = {1, 2, 2, 3};
@@ -171,7 +173,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest3(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NHWC, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -179,7 +181,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest3(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNhwcTest4(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {8, 1, 3, 1};
const unsigned int outputShape[] = {2, 2, 4, 1};
@@ -205,7 +208,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest4(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {2, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NHWC, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -213,7 +216,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest4(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNhwcTest5(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 2, 2, 1};
const unsigned int outputShape[] = {1, 4, 4, 1};
@@ -224,14 +228,16 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest5(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
+ armnn::DataLayout::NHWC, inputShape,
input, blockShape, crops, outputShape, expectedOutput);
}
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNhwcTest6(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 1, 1, 1};
const unsigned int outputShape[] = {1, 2, 2, 1};
@@ -246,7 +252,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest6(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NHWC, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -254,7 +260,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest6(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNhwcTest7(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 1, 1, 3};
const unsigned int outputShape[] = {1, 2, 2, 3};
@@ -266,7 +273,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest7(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NHWC, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -274,7 +281,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest7(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNchwTest1(
armnn::IWorkloadFactory &workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 3, 1, 1};
const unsigned int outputShape[] = {1, 3, 2, 2};
@@ -298,7 +306,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest1(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NCHW, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -306,7 +314,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest1(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNchwTest2(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 1, 1, 1};
const unsigned int outputShape[] = {1, 1, 2, 2};
@@ -321,7 +330,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest2(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NCHW, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -329,7 +338,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest2(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNchwTest3(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 3, 1, 1};
const unsigned int outputShape[] = {1, 3, 2, 2};
@@ -353,7 +363,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest3(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NCHW, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -361,7 +371,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest3(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNchwTest4(
armnn::IWorkloadFactory &workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 3, 1, 1};
const unsigned int outputShape[] = {1, 3, 2, 2};
@@ -385,7 +396,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest4(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NCHW, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -393,7 +404,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest4(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNchwTest5(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 1, 1, 1};
const unsigned int outputShape[] = {1, 1, 2, 2};
@@ -408,7 +420,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest5(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NCHW, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -416,7 +428,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest5(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNchwTest6(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {4, 3, 1, 1};
const unsigned int outputShape[] = {1, 3, 2, 2};
@@ -440,7 +453,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest6(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NCHW, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}
@@ -448,7 +461,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest6(
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchToSpaceNdNchwTest7(
armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const armnn::ITensorHandleFactory& tensorHandleFactory)
{
const unsigned int inputShape[] = {8, 1, 1, 3};
const unsigned int outputShape[] = {2, 1, 2, 4};
@@ -470,7 +484,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest7(
std::vector<unsigned int> blockShape({2, 2});
std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {2, 0}};
- return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
+ return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory,
armnn::DataLayout::NCHW, inputShape, input, blockShape,
crops, outputShape, expectedOutput);
}