Compute Library
 21.11
Scale.cpp File Reference
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/CL/functions/CLScale.h"
#include "arm_compute/runtime/Tensor.h"
#include "arm_compute/runtime/TensorAllocator.h"
#include "tests/CL/CLAccessor.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-2021 Arm Limited.
 
 arm_compute::test
 
 arm_compute::test::validation
 

Typedefs

template<typename T >
using CLScaleMixedDataLayoutFixture = ScaleValidationFixture< CLTensor, CLAccessor, CLScale, T, true >
 

Functions

 TEST_CASE (NullPtr, framework::DatasetMode::ALL)
 
 TEST_CASE (SupportDataType, framework::DatasetMode::ALL)
 
 TEST_CASE (SameInputOutput, framework::DatasetMode::ALL)
 
 TEST_CASE (MissmatchingDataType, framework::DatasetMode::ALL)
 
 TEST_CASE (AlignedCornerNotSupported, framework::DatasetMode::ALL)
 
 TEST_CASE (IncorrectScaleFactor, framework::DatasetMode::ALL)
 
 TEST_SUITE_END () FIXTURE_DATA_TEST_CASE(RunSmall = ActivationValidationQuantizedFixture<CLTensor, CLAccessor, CLActivationLayer, T>
 [CLActivationLayer Test snippet] More...
 
 validate (CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute)
 
 validate (CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16)
 
 validate (CLAccessor(_target), _reference, valid_region, tolerance_q8)
 
 validate (CLAccessor(_target), _reference, valid_region, tolerance_s16)
 
 FIXTURE_DATA_TEST_CASE (RunAlignCorners, CLScaleQuantizedFixture< uint8_t >, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(qasymm8_shape, QuantizationInfoSet), ScaleDataLayouts), ScaleInterpolationPolicySet), datasets::BorderModes()), ScaleAlignCornersSamplingPolicySet))
 
 FIXTURE_DATA_TEST_CASE (RunNightlyAlignCorners, CLScaleQuantizedFixture< uint8_t >, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(qasymm8_nightly_shape, QuantizationInfoSet), ScaleDataLayouts), ScaleInterpolationPolicySet), datasets::BorderModes()), ScaleAlignCornersSamplingPolicySet))
 
 validate (CLAccessor(_target), _reference, valid_region, tolerance_qs8)
 
 FIXTURE_DATA_TEST_CASE (RunAlignCorners, CLScaleQuantizedFixture< int8_t >, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(qasymm8_signed_shape, QuantizationInfoSet), ScaleDataLayouts), ScaleInterpolationPolicySet), datasets::BorderModes()), ScaleAlignCornersSamplingPolicySet))
 
 FIXTURE_DATA_TEST_CASE (RunNightly, CLScaleQuantizedFixture< int8_t >, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(qasymm8_signed_nightly_shape, QuantizationInfoSet), ScaleDataLayouts), ScaleInterpolationPolicySet), datasets::BorderModes()), ScaleSamplingPolicySet))
 
 FIXTURE_DATA_TEST_CASE (RunNightlyAlignCorners, CLScaleQuantizedFixture< int8_t >, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(qasymm8_signed_nightly_shape, QuantizationInfoSet), ScaleDataLayouts), ScaleInterpolationPolicySet), datasets::BorderModes()), ScaleAlignCornersSamplingPolicySet))
 

Variables

const auto default_input_shape = TensorShape{ 2, 3, 3, 2 }
 
const auto default_output_shape = TensorShape{ 4, 6, 3, 2 }
 
constexpr auto default_data_type = DataType::U8
 
constexpr auto default_data_layout = DataLayout::NHWC
 
constexpr auto default_interpolation_policy = InterpolationPolicy::NEAREST_NEIGHBOR
 
constexpr auto default_border_mode = BorderMode::UNDEFINED
 
constexpr bool default_use_padding = false
 
const auto f32_shape = combine((concat(ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<float>() ), 1>(), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<float>() ), 1>())), framework::dataset::make("DataType", DataType::F32))
 
const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED))
 
const auto f32_nightly_shape = combine((concat(concat(concat(ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<float>() ), 0>(), ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<float>() ), 1>()), ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<float>() ), 0>()), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<float>() ), 0>())), framework::dataset::make("DataType", DataType::F32))
 
const auto f16_nightly_shape = combine((concat(concat(concat(ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<half>() ), 0>(), ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<half>() ), 1>()), ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<half>() ), 0>()), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<half>() ), 0>())), framework::dataset::make("DataType", DataType::F16))
 
const auto u8_nightly_shape = combine((concat(concat(concat(ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<uint8_t>() ), 0>(), ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<uint8_t>() ), 1>()), ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<uint8_t>() ), 0>()), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<uint8_t>() ), 0>())), framework::dataset::make("DataType", DataType::U8))
 
const auto s16_nightly_shape = combine((concat(concat(concat(ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<int16_t>() ), 0>(), ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<int16_t>() ), 1>()), ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<int16_t>() ), 0>()), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<int16_t>() ), 0>())), framework::dataset::make("DataType", DataType::S16))
 
const auto qasymm8_shape = combine((concat(ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<uint8_t>() ), 1>(), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<uint8_t>() ), 1>())), framework::dataset::make("DataType", DataType::QASYMM8))
 
const auto qasymm8_nightly_shape = combine((concat(concat(concat(ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<uint8_t>() ), 0>(), ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<uint8_t>() ), 1>()), ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<uint8_t>() ), 0>()), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<uint8_t>() ), 0>())), framework::dataset::make("DataType", DataType::QASYMM8))
 
const auto qasymm8_signed_nightly_shape = combine((concat(concat(concat(ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<int8_t>() ), 0>(), ScaleShapesBaseDataSet<1, 1, ( num_elements_per_vector<int8_t>() ), 1>()), ScaleShapesBaseDataSet<3, 1, ( num_elements_per_vector<int8_t>() ), 0>()), ScaleShapesBaseDataSet<3, 3, ( num_elements_per_vector<int8_t>() ), 0>())), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED))