From 2ff0009ca9245304c48889c8ba8d3a39d42febed Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 30 Sep 2019 16:50:08 +0100 Subject: COMPMID-2661: Implement complex function dynamic tensor support. Change-Id: I80772cb25514009b030e5ade28cbb71ed352da67 Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/2019 Tested-by: Arm Jenkins Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins --- tests/validation/NEON/UNIT/DynamicTensor.cpp | 35 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'tests/validation/NEON/UNIT/DynamicTensor.cpp') diff --git a/tests/validation/NEON/UNIT/DynamicTensor.cpp b/tests/validation/NEON/UNIT/DynamicTensor.cpp index 319aa6a8ee..dde67b06a6 100644 --- a/tests/validation/NEON/UNIT/DynamicTensor.cpp +++ b/tests/validation/NEON/UNIT/DynamicTensor.cpp @@ -22,19 +22,18 @@ * SOFTWARE. */ #include "arm_compute/runtime/Allocator.h" -#include "arm_compute/runtime/MemoryGroup.h" #include "arm_compute/runtime/MemoryManagerOnDemand.h" +#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" #include "arm_compute/runtime/NEON/functions/NENormalizationLayer.h" #include "arm_compute/runtime/OffsetLifetimeManager.h" #include "arm_compute/runtime/PoolManager.h" #include "support/ToolchainSupport.h" #include "tests/AssetsLibrary.h" -#include "tests/Globals.h" #include "tests/NEON/Accessor.h" -#include "tests/Utils.h" #include "tests/framework/Asserts.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" #include "tests/validation/fixtures/UNIT/DynamicTensorFixture.h" namespace arm_compute @@ -45,6 +44,10 @@ namespace validation { namespace { +constexpr AbsoluteTolerance absolute_tolerance_float(0.0001f); /**< Absolute Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ +RelativeTolerance tolerance_f32(0.1f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ +constexpr float tolerance_num = 0.07f; /**< Tolerance number */ + using NENormLayerWrapper = SimpleFunctionWrapper; template <> void NENormLayerWrapper::configure(arm_compute::ITensor *src, arm_compute::ITensor *dst) @@ -55,7 +58,9 @@ void NENormLayerWrapper::configure(arm_compute::ITensor *src, arm_compute::ITens TEST_SUITE(NEON) TEST_SUITE(UNIT) TEST_SUITE(DynamicTensor) -using NEDynamicTensorType3SingleFunction = DynamicTensorType3SingleFunction; + +using OffsetMemoryManagementService = MemoryManagementService; +using NEDynamicTensorType3SingleFunction = DynamicTensorType3SingleFunction; /** Tests the memory manager with dynamic input and output tensors. * @@ -79,6 +84,28 @@ FIXTURE_DATA_TEST_CASE(DynamicTensorType3Single, NEDynamicTensorType3SingleFunct } } +using NEDynamicTensorType3ComplexFunction = DynamicTensorType3ComplexFunction; +/** Tests the memory manager with dynamic input and output tensors. + * + * Create and manage the tensors needed to run a complex function. After the function is executed, + * change the input and output size requesting more memory and go through the manage/allocate process. + * The memory manager should be able to update the inner structures and allocate the requested memory + * */ +FIXTURE_DATA_TEST_CASE(DynamicTensorType3Complex, NEDynamicTensorType3ComplexFunction, framework::DatasetMode::ALL, + framework::dataset::zip(framework::dataset::zip(framework::dataset::zip(framework::dataset::zip( + framework::dataset::make("InputShape", { std::vector{ TensorShape(12U, 12U, 6U), TensorShape(128U, 128U, 6U) } }), + framework::dataset::make("WeightsManager", { TensorShape(3U, 3U, 6U, 3U) })), + framework::dataset::make("BiasShape", { TensorShape(3U) })), + framework::dataset::make("OutputShape", { std::vector{ TensorShape(12U, 12U, 3U), TensorShape(128U, 128U, 3U) } })), + framework::dataset::make("PadStrideInfo", { PadStrideInfo(1U, 1U, 1U, 1U) }))) +{ + for(unsigned int i = 0; i < num_iterations; ++i) + { + run_iteration(i); + validate(Accessor(dst_target), dst_ref, tolerance_f32, tolerance_num, absolute_tolerance_float); + } +} + TEST_SUITE_END() // DynamicTensor TEST_SUITE_END() // UNIT TEST_SUITE_END() // NEON -- cgit v1.2.1