Compute Library
 22.05
Scale.cpp File Reference
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/NEON/functions/NEScale.h"
#include "arm_compute/runtime/Tensor.h"
#include "arm_compute/runtime/TensorAllocator.h"
#include "tests/NEON/Accessor.h"
#include "tests/PaddingCalculator.h"
#include "tests/datasets/ScaleValidationDataset.h"
#include "tests/framework/Asserts.h"
#include "tests/framework/Macros.h"
#include "tests/validation/Helpers.h"
#include "tests/validation/Validation.h"
#include "tests/validation/fixtures/ScaleFixture.h"

Go to the source code of this file.

Namespaces

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

Typedefs

template<typename T >
using NEScaleFixture = ScaleValidationFixture< Tensor, Accessor, NEScale, T >
 
template<typename T >
using NEScaleMixedDataLayoutFixture = ScaleValidationFixture< Tensor, Accessor, NEScale, T, true >
 
template<typename T >
using NEScaleQuantizedFixture = ScaleValidationQuantizedFixture< Tensor, Accessor, NEScale, T >
 
template<typename T >
using NEScaleQuantizedMixedDataLayoutFixture = ScaleValidationQuantizedFixture< Tensor, Accessor, NEScale, T, true >
 

Functions

 TEST_CASE (NullPtr, framework::DatasetMode::ALL)
 
 TEST_CASE (SupportDataType, framework::DatasetMode::ALL)
 
 TEST_CASE (MissmatchingDataType, framework::DatasetMode::ALL)
 
 TEST_CASE (UsePadding, framework::DatasetMode::ALL)
 
 TEST_CASE (AreaWithNHWC, framework::DatasetMode::ALL)
 
 TEST_CASE (AreaWithNonU8, framework::DatasetMode::ALL)
 
 TEST_CASE (AlignedCornerNotSupported, framework::DatasetMode::ALL)
 
 TEST_SUITE_END () FIXTURE_DATA_TEST_CASE(RunSmall = ActivationValidationQuantizedFixture<CLTensor, CLAccessor, CLActivationLayer, T>
 [CLActivationLayer Test snippet] More...
 
 combine (combine(combine(combine(datasets::Medium4DShapes(), framework::dataset::make("DataType", { DataType::F32, DataType::QASYMM8 })), framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::BILINEAR, InterpolationPolicy::NEAREST_NEIGHBOR })), framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER, SamplingPolicy::TOP_LEFT })), framework::dataset::make("DataLayout", { DataLayout::NHWC, DataLayout::NCHW }))
 
src_target info () -> extend_padding(PaddingSize(3, 5, 9, 1))
 
shape_scaled set (idx_width, shape[idx_width] *scale_x, false)
 
shape_scaled set (idx_height, shape[idx_height] *scale_y, false)
 
 ARM_COMPUTE_EXPECT (src.info() ->is_resizable(), framework::LogLevel::ERRORS)
 
 ARM_COMPUTE_EXPECT (dst.info() ->is_resizable(), framework::LogLevel::ERRORS)
 
 validate (src.info() ->padding(), PaddingSize(0, 0, 0, 0))
 
 validate (dst.info() ->padding(), PaddingSize(0, 0, 0, 0))
 
 DATA_TEST_CASE (CheckNoPaddingInterpAREA, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::Medium4DShapes(), framework::dataset::make("DataType", { DataType::U8 })), framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::AREA })), framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER, SamplingPolicy::TOP_LEFT })), framework::dataset::make("DataLayout", { DataLayout::NCHW })), shape, data_type, interpolation_policy, sampling_policy, data_layout)
 
 validate (Accessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32)
 
 validate (Accessor(_target), _reference, valid_region, tolerance_u8)
 
 validate (Accessor(_target), _reference, valid_region, tolerance_s16, tolerance_num_s16)
 
 FIXTURE_DATA_TEST_CASE (RunMixedDataLayout, NEScaleQuantizedMixedDataLayoutFixture< uint8_t >, framework::DatasetMode::ALL, ASSEMBLE_QUANTIZED_DATASET(qasymm8_shape, ScaleSamplingPolicySet, QuantizationInfoSet))
 
 FIXTURE_DATA_TEST_CASE (RunSmallAlignCorners, NEScaleQuantizedFixture< uint8_t >, framework::DatasetMode::ALL, ASSEMBLE_QUANTIZED_DATASET(qasymm8_shape, ScaleAlignCornersSamplingPolicySet, QuantizationInfoSet))
 
 validate (Accessor(_target), _reference, valid_region, tolerance_qasymm8_signed)
 
 FIXTURE_DATA_TEST_CASE (RunSmallAlignCorners, NEScaleQuantizedFixture< int8_t >, framework::DatasetMode::ALL, ASSEMBLE_QUANTIZED_DATASET(qasymm8_signed_shape, ScaleAlignCornersSamplingPolicySet, QuantizationInfoSet))
 

Variables

constexpr auto default_sampling_policy = SamplingPolicy::CENTER
 
 interpolation_policy
 
 sampling_policy
 
ScaleKernelInfo info (interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
 
const float scale_x = 0.5f
 
const float scale_y = 0.5f
 
TensorShape shape_scaled (shape)
 
const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH)
 
const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT)
 
NEScale scale
 
const auto f32_shape_nhwc = combine(datasets::Small3DShapes(), framework::dataset::make("DataType", DataType::F32))
 
constexpr AbsoluteTolerance< int8_t > tolerance_qasymm8_signed { 1 }