Compute Library
 23.11
Im2Col.cpp File Reference
#include "arm_compute/core/Types.h"
#include "src/cpu/kernels/CpuIm2ColKernel.h"
#include "tests/NEON/Accessor.h"
#include "tests/NEON/Helper.h"
#include "tests/datasets/ShapeDatasets.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/Im2ColFixture.h"

Go to the source code of this file.

Namespaces

 arm_compute
 Copyright (c) 2017-2023 Arm Limited.
 
 arm_compute::test
 
 arm_compute::test::validation
 

Typedefs

using CpuIm2Col = NESynthetizeFunctionWithZeroConstantKernelBorder< cpu::kernels::CpuIm2ColKernel >
 
template<typename T >
using CpuIm2ColFixture = Im2ColOpValidationFixture< Tensor, Accessor, CpuIm2Col, T, false >
 

Functions

 DATA_TEST_CASE (Validate, framework::DatasetMode::ALL, zip(zip(zip(framework::dataset::make("InputInfo", { TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::U8), TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::F32), TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(10U, 12U, 2U, 2U), 1, DataType::QASYMM8), }), framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16), TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16), TensorInfo(TensorShape(3U, 3U, 10U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(18U, 80U, 1U, 2U), 1, DataType::QASYMM8), })), framework::dataset::make("HasBias", { true, true, true, false, false })), framework::dataset::make("Expected", { false, false, false, false, true })), input_info, output_info, has_bias, expected)
 
 FIXTURE_DATA_TEST_CASE (RunSmall, CpuIm2ColFixture< float >, framework::DatasetMode::PRECOMMIT, combine(combine(im2col_shapes, framework::dataset::make("DataType", DataType::F32)), conv_args_small))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, CpuIm2ColFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(concat(im2col_shapes, datasets::LargeShapes()), framework::dataset::make("DataType", DataType::F32)), conv_args))
 
 TEST_SUITE_END () FIXTURE_DATA_TEST_CASE(RunSmall = ActivationValidationQuantizedFixture<CLTensor, CLAccessor, CLActivationLayer, T>
 [CLActivationLayer Test snippet] More...
 
 combine (combine(im2col_shapes, framework::dataset::make("DataType", DataType::QASYMM8)), conv_args_small))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, CpuIm2ColFixture< uint8_t >, framework::DatasetMode::NIGHTLY, combine(combine(concat(im2col_shapes, datasets::LargeShapes()), framework::dataset::make("DataType", DataType::QASYMM8)), conv_args))
 
const PadStrideInfo conv_info (1U, 1U, 0U, 0U)
 
src_info set_data_layout (data_layout)
 
im2col_func configure (src_target.info(), dst_target.info(), spatial_kernel, conv_info, has_bias)
 
 ARM_COMPUTE_EXPECT (src_target.info() ->is_resizable(), framework::LogLevel::ERRORS)
 
 ARM_COMPUTE_EXPECT (dst_target.info() ->is_resizable(), framework::LogLevel::ERRORS)
 
input allocator () -> allocate()
 
 ARM_COMPUTE_EXPECT (!src_target.info() ->is_resizable(), framework::LogLevel::ERRORS)
 
 ARM_COMPUTE_EXPECT (!dst_target.info() ->is_resizable(), framework::LogLevel::ERRORS)
 
library fill_tensor_uniform (Accessor(src_target), 0)
 
im2col_func run (pack)
 
library fill_tensor_uniform (src_ref, 0)
 
 validate (Accessor(dst_target), dst_ref)
 

Variables

 CpuIm2ColFixture< uint8_t >
 
const DataLayout data_layout = DataLayout::NHWC
 
const bool has_bias = false
 
const unsigned int num_groups = 1
 
const Size2D spatial_kernel (3, 3)
 
const QuantizationInfo qinfo {}
 
TensorInfo src_info (src_shape, 1, data_type)
 
Tensor src_target = create_tensor<Tensor>(src_shape, data_type, 1, qinfo, data_layout)
 
Tensor dst_target = create_tensor<Tensor>(dst_shape, data_type, 1, qinfo)
 
CpuIm2Col im2col_func
 
ITensorPack pack
 
SimpleTensor< float > src_ref { src_shape, data_type, 1, qinfo, data_layout }
 
ScaleKernelInfo info (interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)