31 #include "tests/datasets/BorderModeDataset.h" 32 #include "tests/datasets/InterpolationPolicyDataset.h" 33 #include "tests/datasets/SamplingPolicyDataset.h" 34 #include "tests/datasets/ShapeDatasets.h" 40 #include "tests/validation/fixtures/ScaleFixture.h" 66 constexpr AbsoluteTolerance<uint8_t> tolerance_u8(1);
67 constexpr AbsoluteTolerance<int16_t> tolerance_s16(1);
68 RelativeTolerance<float> tolerance_f32(0.01);
70 constexpr
float tolerance_num_s16 = 0.01f;
71 constexpr
float tolerance_num_f32 = 0.01f;
121 &output_info.clone()->set_is_resizable(
false).set_data_layout(data_layout),
122 policy,
border_mode, constant_border, sampling_policy);
130 datasets::BorderModes()),
132 shape,
data_type, data_layout, policy, border_mode, sampling_policy)
134 std::mt19937 generator(
library->seed());
135 std::uniform_real_distribution<float> distribution_float(0.25, 2);
136 const float scale_x = distribution_float(generator);
137 const float scale_y = distribution_float(generator);
138 uint8_t constant_border_value = 0;
142 std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
143 constant_border_value = distribution_u8(generator);
158 shape_scaled.
set(idx_width, src_shape[idx_width] * scale_x);
159 shape_scaled.
set(idx_height, src_shape[idx_height] * scale_y);
170 nescale.
configure(&src, &dst, policy, border_mode, constant_border_value, sampling_policy);
177 int num_elements_processed_x = 16;
191 read_padding.
top = 1;
196 validate(dst.info()->padding(), write_padding);
199 template <
typename T>
208 datasets::BorderModes()),
216 validate(
Accessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32);
222 datasets::BorderModes()),
230 validate(
Accessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32);
241 datasets::BorderModes()),
255 datasets::BorderModes()),
271 datasets::BorderModes()),
279 validate(
Accessor(_target), _reference, valid_region, tolerance_s16, tolerance_num_s16);
285 datasets::BorderModes()),
293 validate(
Accessor(_target), _reference, valid_region, tolerance_s16, tolerance_num_s16);
ScaleValidationFixture< Tensor, Accessor, NEScale, T > NEScaleFixture
unsigned int top
top of the border
Class describing the value of a pixel for any image format.
Container for 2D border size.
1 channel, 1 U8 per channel
1 channel, 1 F32 per channel
Strides PermutationVector
Permutation vector.
Output values are defined by bilinear interpolation between the pixels.
PaddingCalculator calculator(shape.x(), 8)
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
PaddingSize required_padding() const
Compute the required padding.
Output values are defined to match the source pixel whose center is nearest to the sample position...
Basic function to run NEScaleKernel.
This file contains all available output stages for GEMMLowp on OpenCL.
Samples are taken at pixel center.
#define TEST_SUITE(SUITE_NAME)
void permute(Dimensions< T > &dimensions, const PermutationVector &perm)
Permutes given Dimensions according to a permutation vector.
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsoluteDifferenceFixture< uint8_t >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), AbsoluteDifferenceU8Dataset))
validate(dst.info() ->valid_region(), dst_valid_region)
Accessor implementation for Tensor objects.
DatasetMode
Possible dataset modes.
std::unique_ptr< AssetsLibrary > library
Samples are taken at pixel top left corner.
Basic implementation of the tensor interface.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
virtual PaddingSize padding() const =0
Padding of tensor.
1 channel, 1 S16 per channel
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
Num samples, channels, height, width.
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), AbsoluteDifferenceU8Dataset), shape, data_type0, data_type1, output_data_type)
void configure(ITensor *input, ITensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value=PixelValue(), SamplingPolicy sampling_policy=SamplingPolicy::CENTER)
Initialize the function's source, destination, interpolation type and border_mode.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value=PixelValue(), SamplingPolicy sampling_policy=SamplingPolicy::CENTER)
Static function to check if given info will lead to a valid configuration of NEScale.
TEST_SUITE_END() DATA_TEST_CASE(Configuration
const ValidRegion dst_valid_region
ARM_COMPUTE_EXPECT(src.info() ->is_resizable(), framework::LogLevel::ERRORS)
Borders are left undefined.
Pixels outside the image are assumed to have the same value as the closest image pixel.
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.
Num samples, height, width, channels.
Pixels outside the image are assumed to have a constant value.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true)
Accessor to set the value of one of the dimensions.
combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType",{DataType::U8, DataType::S16})), datasets::BorderModes()), framework::dataset::make("filter_size",{5}))
Store the tensor's metadata.
JoinDataset< T, U > concat(T &&dataset1, U &&dataset2)
Helper function to create a JoinDataset.
Quantization settings (used for QASYMM8 data type)
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.
DataLayout
Supported tensor data layouts.
zip(zip(zip(framework::dataset::make("InputInfo",{TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F16), TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::QASYMM8), TensorInfo(TensorShape(5U, 5U, 5U, 3U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 37U, 2U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 37U, 22U), 1, DataType::F32)}), framework::dataset::make("OutputInfo",{TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F16), TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::QASYMM8), TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32), TensorInfo(TensorShape(1U, 1U, 16U), 1, DataType::F32), TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32), TensorInfo(TensorShape(2U, 37U, 16U), 1, DataType::F32), TensorInfo(TensorShape(22U, 37U, 36U), 1, DataType::F32)})), framework::dataset::make("WinogradInfo",{WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(3U, 3U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW)})), framework::dataset::make("Expected",{false, false, false, false, true, true, true}))
convolution configure & src
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
Calculate required padding.
void set_border_mode(BorderMode mode)
Set border mode.