31 #include "tests/datasets/ScaleValidationDataset.h" 36 #include "tests/validation/fixtures/ScaleFixture.h" 46 using datasets::ScaleShapesBaseDataSet;
47 using datasets::ScaleInterpolationPolicySet;
48 using datasets::ScaleDataLayouts;
49 using datasets::ScaleSamplingPolicySet;
50 using datasets::ScaleAlignCornersSamplingPolicySet;
57 constexpr uint32_t vector_byte = 64;
60 constexpr uint32_t num_elements_per_vector()
62 return vector_byte /
sizeof(T);
76 QuantizationInfo(0.5f, -10),
80 constexpr AbsoluteTolerance<uint8_t> tolerance_u8(1);
81 constexpr AbsoluteTolerance<int16_t> tolerance_s16(1);
83 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 87 constexpr
float tolerance_num_s16 = 0.01f;
88 constexpr
float tolerance_num_f32 = 0.01f;
114 const auto input_shape = TensorShape{ 2, 3, 3, 2 };
140 const std::map<DataType, bool> supported_data_types =
157 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 159 #else // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 161 #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 167 for(
auto &kv : supported_data_types)
197 constexpr
bool use_padding =
true;
236 constexpr
bool align_corners =
true;
296 const float scale_x = 0.5f;
297 const float scale_y = 0.5f;
301 shape_scaled.
set(idx_width, shape[idx_width] * scale_x,
false);
302 shape_scaled.
set(idx_height, shape[idx_height] * scale_y,
false);
317 template <
typename T>
319 template <
typename T>
344 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 371 const auto u8_shape =
combine((SCALE_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), framework::dataset::
make("
DataType", DataType::U8));
392 const auto s16_shape =
combine((SCALE_SHAPE_DATASET(num_elements_per_vector<int16_t>())), framework::dataset::
make("DataType", DataType::S16));
400 validate(
Accessor(_target), _reference, valid_region, tolerance_s16, tolerance_num_s16);
409 validate(
Accessor(_target), _reference, valid_region, tolerance_s16, tolerance_num_s16);
416 const auto
qasymm8_shape =
combine((SCALE_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), framework::dataset::
make("DataType", DataType::QASYMM8));
427 QuantizationInfoSet))
450 QuantizationInfoSet))
ScaleValidationFixture< Tensor, Accessor, NEScale, T > NEScaleFixture
Class describing the value of a pixel for any image format.
Class reprensenting an absolute tolerance value.
RelativeTolerance< float > tolerance_f32(0.001f)
F32 Tolerance value for comparing reference's output against implementation's output for floating poi...
quantized, symmetric fixed-point 16-bit number
constexpr auto default_data_type
TensorShape shape_scaled(shape)
1 channel, 1 U8 per channel
constexpr auto default_sampling_policy
half_float::half half
16-bit floating point type
1 channel, 1 F32 per channel
ARM_COMPUTE_EXPECT(has_error==expected, framework::LogLevel::ERRORS)
Output values are defined by bilinear interpolation between the pixels.
const DataLayout data_layout
ScaleValidationQuantizedFixture< Tensor, Accessor, NEScale, T > NEScaleQuantizedFixture
quantized, asymmetric fixed-point 16-bit number
1 channel, 1 U16 per channel
constexpr AbsoluteTolerance< int8_t > tolerance_qasymm8_signed
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
Output values are defined to match the source pixel whose center is nearest to the sample position...
Basic function to run NEScaleKernel.
const ValidRegion valid_region
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
Samples are taken at pixel center.
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
1 channel, 1 S32 per channel
16-bit brain floating-point number
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), }), framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), })), framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::SQRT), })), framework::dataset::make("Expected", { false, true, true, true, false, false, true, true, false })), input_info, output_info, act_info, expected)
TensorShape input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
Accessor implementation for Tensor objects.
DatasetMode
Possible dataset modes.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info)
Static function to check if given info will lead to a valid configuration of NEScale.
1 channel, 1 U32 per channel
virtual ITensorInfo & set_data_layout(const DataLayout &data_layout)=0
Set the data layout of the tensor.
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
[CLActivationLayer Test snippet]
quantized, asymmetric fixed-point 8-bit number unsigned
Samples are taken at pixel top left corner.
Basic implementation of the tensor interface.
TEST_SUITE(U8_to_S8) FIXTURE_DATA_TEST_CASE(RunSmall
validate(CLAccessor(output_state), expected_output)
virtual PaddingSize padding() const =0
Padding of tensor.
BorderSize PaddingSize
Container for 2D padding size.
constexpr auto default_border_mode
constexpr auto default_data_layout
void configure(ITensor *input, ITensor *output, const ScaleKernelInfo &info)
Initialize the function's source, destination, interpolation type and border_mode.
1 channel, 1 S16 per channel
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
quantized, symmetric fixed-point 8-bit number
Num samples, channels, height, width.
TensorInfo src_info(src_shape, 1, data_type)
quantized, symmetric per channel fixed-point 8-bit number
ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy interpolate_policy, SamplingPolicy sampling_policy, bool border_undefined)
Helper function to calculate the Valid Region for Scale.
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsLayerFixture< half >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)))
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Borders are left undefined.
Num samples, height, width, channels.
constexpr auto default_interpolation_policy
Store the tensor's metadata.
TEST_CASE(FusedActivation, framework::DatasetMode::ALL)
Validate fused activation expecting the following behaviours:
quantized, asymmetric fixed-point 8-bit number signed
64-bit floating-point number
RelativeTolerance< half_float::half > tolerance_f16(half(0.2))
F16 Tolerance value for comparing reference's output against implementation's output for floating poi...
Container for valid region of a window.
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
DataType
Available data types.
combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)))
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.