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/CL/UNIT/DynamicTensor.cpp | 31 +++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'tests/validation/CL') diff --git a/tests/validation/CL/UNIT/DynamicTensor.cpp b/tests/validation/CL/UNIT/DynamicTensor.cpp index 38acbd5c3a..06670478b2 100644 --- a/tests/validation/CL/UNIT/DynamicTensor.cpp +++ b/tests/validation/CL/UNIT/DynamicTensor.cpp @@ -23,6 +23,7 @@ */ #include "arm_compute/runtime/BlobLifetimeManager.h" #include "arm_compute/runtime/CL/CLBufferAllocator.h" +#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" #include "arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h" #include "arm_compute/runtime/MemoryGroup.h" #include "arm_compute/runtime/MemoryManagerOnDemand.h" @@ -35,6 +36,7 @@ #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 +47,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 CLL2NormLayerWrapper = SimpleFunctionWrapper; template <> void CLL2NormLayerWrapper::configure(ICLTensor *src, ICLTensor *dst) @@ -56,7 +62,8 @@ TEST_SUITE(CL) TEST_SUITE(UNIT) TEST_SUITE(DynamicTensor) -using CLDynamicTensorType3SingleFunction = DynamicTensorType3SingleFunction; +using BlobMemoryManagementService = MemoryManagementService; +using CLDynamicTensorType3SingleFunction = DynamicTensorType3SingleFunction; /** Tests the memory manager with dynamic input and output tensors. * @@ -97,6 +104,28 @@ FIXTURE_DATA_TEST_CASE(DynamicTensorType3Single, CLDynamicTensorType3SingleFunct } } +using CLDynamicTensorType3ComplexFunction = 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, CLDynamicTensorType3ComplexFunction, framework::DatasetMode::ALL, + framework::dataset::zip(framework::dataset::zip(framework::dataset::zip(framework::dataset::zip( + framework::dataset::make("InputShape", { std::vector{ TensorShape(12U, 12U, 16U), TensorShape(64U, 64U, 16U) } }), + framework::dataset::make("WeightsManager", { TensorShape(3U, 3U, 16U, 5U) })), + framework::dataset::make("BiasShape", { TensorShape(5U) })), + framework::dataset::make("OutputShape", { std::vector{ TensorShape(12U, 12U, 5U), TensorShape(64U, 64U, 5U) } })), + framework::dataset::make("PadStrideInfo", { PadStrideInfo(1U, 1U, 1U, 1U) }))) +{ + for(unsigned int i = 0; i < num_iterations; ++i) + { + run_iteration(i); + validate(CLAccessor(dst_target), dst_ref, tolerance_f32, tolerance_num, absolute_tolerance_float); + } +} + TEST_SUITE_END() // DynamicTensor TEST_SUITE_END() // UNIT TEST_SUITE_END() // CL -- cgit v1.2.1