46 auto valid_start_out_x =
static_cast<int>(valid_start_in_x *
scale_x);
47 auto valid_start_out_y =
static_cast<int>(valid_start_in_y *
scale_y);
48 auto valid_end_out_x = std::min<int>(std::ceil(valid_end_in_x * scale_x), dst_shape[
idx_width]);
49 auto valid_end_out_y = std::min<int>(std::ceil(valid_end_in_y * scale_y), dst_shape[
idx_height]);
54 switch(interpolate_policy)
60 valid_start_out_x = std::ceil(valid_start_in_x * scale_x - sampling_point);
61 valid_start_out_y = std::ceil(valid_start_in_y * scale_y - sampling_point);
65 valid_end_out_x = std::ceil(valid_end_in_x * scale_x - sampling_point);
66 valid_end_out_y = std::ceil(valid_end_in_y * scale_y - sampling_point);
73 valid_start_out_x = std::ceil((valid_start_in_x + sampling_point) * scale_x - sampling_point);
74 valid_start_out_y = std::ceil((valid_start_in_y + sampling_point) * scale_y - sampling_point);
78 valid_end_out_x = std::floor((valid_end_in_x - 1.f + sampling_point) * scale_x - sampling_point + 1.f);
79 valid_end_out_y = std::floor((valid_end_in_y - 1.f + sampling_point) * scale_y - sampling_point + 1.f);
98 valid_region.
shape.
set(idx_width, std::min<size_t>(valid_end_out_x - valid_start_out_x, dst_shape[idx_width]));
99 valid_region.
shape.
set(idx_height, std::min<size_t>(valid_end_out_y - valid_start_out_y, dst_shape[idx_height]));
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
InterpolationPolicy
Interpolation method.
TensorShape shape
Shape of the valid region.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Output values are defined by bilinear interpolation between the pixels.
const DataLayout data_layout
Store the tensor's metadata.
Output values are defined to match the source pixel whose center is nearest to the sample position...
const ValidRegion valid_region
Copyright (c) 2017-2021 Arm Limited.
virtual ValidRegion valid_region() const =0
Valid region of the tensor.
Samples are taken at pixel center.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
TensorInfo src_info(src_shape, 1, data_type)
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.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
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.
DataLayout
[DataLayout enum definition]
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.
Coordinates anchor
Anchor for the start of the valid region.
SamplingPolicy
Available Sampling Policies.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.