diff options
Diffstat (limited to 'tests/validation')
-rw-r--r-- | tests/validation/CL/Im2Col.cpp | 42 | ||||
-rw-r--r-- | tests/validation/CL/UNIT/DynamicTensor.cpp | 1 | ||||
-rw-r--r-- | tests/validation/fixtures/Im2ColFixture.h | 86 |
3 files changed, 21 insertions, 108 deletions
diff --git a/tests/validation/CL/Im2Col.cpp b/tests/validation/CL/Im2Col.cpp index c6006efcba..041f549777 100644 --- a/tests/validation/CL/Im2Col.cpp +++ b/tests/validation/CL/Im2Col.cpp @@ -22,7 +22,7 @@ * SOFTWARE. */ #include "arm_compute/core/Types.h" -#include "src/core/CL/kernels/CLIm2ColKernel.h" +#include "src/core/gpu/cl/kernels/ClIm2ColKernel.h" #include "tests/CL/CLAccessor.h" #include "tests/CL/Helper.h" #include "tests/framework/Asserts.h" @@ -40,7 +40,7 @@ namespace validation TEST_SUITE(CL) TEST_SUITE(Im2Col) -using CLIm2Col = CLSynthetizeFunction<CLIm2ColKernel>; +using ClIm2Col = ClSynthetizeOperatorWithBorder<opencl::kernels::ClIm2ColKernel>; /** Negative tests * @@ -63,7 +63,7 @@ TEST_CASE(Negative, framework::DatasetMode::ALL) const auto output = TensorInfo(TensorShape(9U, 10U, 12U, 2U), 1, DataType::F32); const auto conv_size = Size2D(3, 3); const bool has_bias = false; - const auto status = CLIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); + const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); } @@ -73,7 +73,7 @@ TEST_CASE(Negative, framework::DatasetMode::ALL) const auto output = TensorInfo(TensorShape(9U, 80U, 2U), 1, DataType::QASYMM8); const auto conv_size = Size2D(3, 3); const bool has_bias = true; - const auto status = CLIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); + const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); } @@ -84,7 +84,7 @@ TEST_CASE(Negative, framework::DatasetMode::ALL) const auto conv_size = Size2D(3, 3); const auto dilation = Size2D(0, 1); const bool has_bias = false; - const auto status = CLIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation); + const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation); ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); } @@ -96,7 +96,7 @@ TEST_CASE(Negative, framework::DatasetMode::ALL) const auto dilation = Size2D(1, 1); const bool has_bias = false; const unsigned int num_groups = 2; - const auto status = CLIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation, num_groups); + const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation, num_groups); ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); } @@ -108,7 +108,7 @@ TEST_CASE(Negative, framework::DatasetMode::ALL) const auto dilation = Size2D(1, 1); const bool has_bias = false; const unsigned int num_groups = 2; - const auto status = CLIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation, num_groups); + const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias, dilation, num_groups); ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); } @@ -118,7 +118,7 @@ TEST_CASE(Negative, framework::DatasetMode::ALL) const auto output = TensorInfo(TensorShape(9U, 81U, 2U), 1, DataType::F32); const auto conv_size = Size2D(3, 3); const bool has_bias = false; - const auto status = CLIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); + const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); } @@ -128,13 +128,13 @@ TEST_CASE(Negative, framework::DatasetMode::ALL) const auto output = TensorInfo(TensorShape(1U, 1U, 1U, 2U), 1, DataType::F32, DataLayout::NHWC); const auto conv_size = Size2D(9, 9); const bool has_bias = false; - const auto status = CLIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); + const auto status = opencl::kernels::ClIm2ColKernel::validate(&input, &output, conv_size, PadStrideInfo(), has_bias); ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); } } template <typename T> -using CLIm2ColFixture = Im2ColValidationFixture<CLTensor, CLAccessor, CLIm2Col, T, true>; +using ClIm2ColFixture = Im2ColOpValidationFixture<CLTensor, CLAccessor, ClIm2Col, T, true>; TEST_SUITE(NHWC) @@ -150,7 +150,7 @@ TEST_SUITE(NHWC) * Kernel tested im2col3x3_nhwc */ FIXTURE_DATA_TEST_CASE(W3x3, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", @@ -180,7 +180,7 @@ framework::dataset::make("Groups", 1))) * Kernel tested im2col9x9_nhwc */ FIXTURE_DATA_TEST_CASE(W9x9, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", @@ -210,7 +210,7 @@ framework::dataset::make("Groups", 1))) * Kernel tested im2col_generic_nhwc */ FIXTURE_DATA_TEST_CASE(Generic, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", @@ -243,7 +243,7 @@ TEST_SUITE(NCHW) * Kernel tested im2col1x1_stridex1_nchw */ FIXTURE_DATA_TEST_CASE(W1x1_Stride1_NoPad, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", { TensorShape(4U, 4U, 3U, 2U), TensorShape(5U, 4U, 3U, 2U), TensorShape(3U, 4U, 3U, 2U) }), @@ -267,7 +267,7 @@ FIXTURE_DATA_TEST_CASE(W1x1_Stride1_NoPad, * Kernel tested im2col3x3_nchw */ FIXTURE_DATA_TEST_CASE(W3x3, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", TensorShape(4U, 4U, 3U, 2U)), @@ -291,7 +291,7 @@ FIXTURE_DATA_TEST_CASE(W3x3, * Kernel tested im2col5x5_nchw */ FIXTURE_DATA_TEST_CASE(W5x5, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", TensorShape(7U, 4U, 3U, 2U)), @@ -317,7 +317,7 @@ FIXTURE_DATA_TEST_CASE(W5x5, * Kernel tested im2col11x11_padx0_pady0_nchw */ FIXTURE_DATA_TEST_CASE(W11x11_NoPad, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", { TensorShape(11U, 11U, 2U, 2U), TensorShape(14U, 13U, 1U, 2U) }), @@ -341,7 +341,7 @@ FIXTURE_DATA_TEST_CASE(W11x11_NoPad, * Kernel tested im2col_generic_padx0_pady0_nchw */ FIXTURE_DATA_TEST_CASE(GenericZeroPad, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", TensorShape(13U, 11U, 2U, 2U)), @@ -367,7 +367,7 @@ TEST_SUITE_END() // NCHW * Kernel tested im2col_generic_(nchw|nhwc) */ FIXTURE_DATA_TEST_CASE(Generic, - CLIm2ColFixture<float>, + ClIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", TensorShape(13U, 11U, 5U, 2U)), @@ -393,7 +393,7 @@ FIXTURE_DATA_TEST_CASE(Generic, * - im2col9x9_nhwc */ FIXTURE_DATA_TEST_CASE(Quantized, - CLIm2ColFixture<uint8_t>, + ClIm2ColFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", TensorShape(13U, 11U, 11U, 2U)), @@ -419,7 +419,7 @@ FIXTURE_DATA_TEST_CASE(Quantized, * - im2col9x9_nhwc */ FIXTURE_DATA_TEST_CASE(FP16, - CLIm2ColFixture<half>, + ClIm2ColFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine( framework::dataset::make("InputShape", TensorShape(13U, 11U, 11U, 2U)), diff --git a/tests/validation/CL/UNIT/DynamicTensor.cpp b/tests/validation/CL/UNIT/DynamicTensor.cpp index ad2d4892ba..f83a92ec2f 100644 --- a/tests/validation/CL/UNIT/DynamicTensor.cpp +++ b/tests/validation/CL/UNIT/DynamicTensor.cpp @@ -29,7 +29,6 @@ #include "arm_compute/runtime/MemoryManagerOnDemand.h" #include "arm_compute/runtime/PoolManager.h" #include "src/core/CL/kernels/CLFillBorderKernel.h" -#include "src/core/CL/kernels/CLIm2ColKernel.h" #include "src/core/CL/kernels/CLL2NormalizeLayerKernel.h" #include "src/core/CL/kernels/CLReductionOperationKernel.h" #include "src/core/CL/kernels/CLWeightsReshapeKernel.h" diff --git a/tests/validation/fixtures/Im2ColFixture.h b/tests/validation/fixtures/Im2ColFixture.h index 38970116f6..a0732c3eb3 100644 --- a/tests/validation/fixtures/Im2ColFixture.h +++ b/tests/validation/fixtures/Im2ColFixture.h @@ -134,92 +134,6 @@ protected: bool _has_bias{}; unsigned int _num_groups{}; }; - -template <typename TensorType, typename AccessorType, typename FunctionType, typename T, bool batch_size_on_z> -class Im2ColValidationFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape input_shape, DataType data_type, const Size2D &kernel_dims, const PadStrideInfo &conv_info, const QuantizationInfo &quant_info, const DataLayout &data_layout, - unsigned int num_groups) - { - _kernel_dims = kernel_dims; - _conv_info = conv_info; - _quant_info = quant_info; - _data_layout = data_layout; - _has_bias = data_type != DataType::QASYMM8; - _num_groups = num_groups; - - if(_data_layout == DataLayout::NHWC) - { - permute(input_shape, PermutationVector(2U, 0U, 1U)); - } - - TensorInfo input_info(input_shape, 1, data_type); - input_info.set_data_layout(_data_layout); - - const TensorShape output_shape = compute_im2col_conv_shape(&input_info, _kernel_dims, _conv_info, _has_bias, Size2D(1U, 1U), batch_size_on_z && _num_groups == 1, _num_groups); - _target = compute_target(input_shape, output_shape, data_type); - - compute_reference(input_shape, output_shape, data_type); - } - -protected: - template <typename U> - void fill(U &&tensor) - { - library->fill_tensor_uniform(tensor, 0); - } - - TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type) - { - // Create tensors - TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, _quant_info, _data_layout); - TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, _quant_info); - - // Create and configure function - FunctionType im2col_func; - im2col_func.configure(&src, &dst, _kernel_dims, _conv_info, _has_bias, Size2D(1U, 1U), _num_groups); - - ARM_COMPUTE_ASSERT(src.info()->is_resizable()); - ARM_COMPUTE_ASSERT(dst.info()->is_resizable()); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - ARM_COMPUTE_ASSERT(!src.info()->is_resizable()); - ARM_COMPUTE_ASSERT(!dst.info()->is_resizable()); - - // Fill tensors - fill(AccessorType(src)); - - // Compute function - im2col_func.run(); - - return dst; - } - - void compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type) - { - // Create reference - SimpleTensor<T> src{ input_shape, data_type, 1, _quant_info, _data_layout }; - _reference = SimpleTensor<T>(output_shape, data_type, 1, _quant_info, DataLayout::NCHW); - - // Fill reference - fill(src); - - reference::im2col<T>(src, _reference, _kernel_dims, _conv_info, _has_bias, _num_groups); - } - TensorType _target{}; - SimpleTensor<T> _reference{}; - Size2D _kernel_dims{}; - PadStrideInfo _conv_info{}; - DataLayout _data_layout{}; - QuantizationInfo _quant_info{}; - bool _has_bias{}; - unsigned int _num_groups{}; -}; } // namespace validation } // namespace test } // namespace arm_compute |