24.02
|
Go to the documentation of this file.
36 const ITensor *
src{
nullptr};
37 ITensor *
dst{
nullptr};
42 std::unique_ptr<cpu::CpuScale> op{
nullptr};
56 _impl->op = std::make_unique<cpu::CpuScale>();
67 const bool is_align_corners_used =
87 if (precompute_indices_weights)
92 _impl->dx.allocator()->init(tensor_info_dxdy);
93 _impl->dy.allocator()->init(tensor_info_dxdy);
94 _impl->offsets.allocator()->init(tensor_info_offsets);
95 switch (policy_to_use)
100 _impl->offsets.allocator()->allocate();
106 _impl->dx.allocator()->allocate();
107 _impl->dy.allocator()->allocate();
108 _impl->offsets.allocator()->allocate();
142 _impl->op->run(
pack);
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const ScaleKernelInfo &info)
Static function to check if given info will lead to a valid configuration.
SimpleTensor< float > src
DataLayout
[DataLayout enum definition]
@ AREA
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
InterpolationPolicy
Interpolation method.
Interface for CPU tensor.
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
constexpr auto data_layout
DataLayout data_layout
Data layout to use.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
BorderMode border_mode
Border mode policy.
void configure(ITensor *input, ITensor *output, const ScaleKernelInfo &info)
Initialize the function's source, destination, interpolation type and border_mode.
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.
bool is_precomputation_required(DataLayout data_layout, DataType data_type, InterpolationPolicy policy, BorderMode border_mode)
Returns if precomputation of indices and/or weights is required or/not.
bool align_corners
Align corners of input and output.
@ BILINEAR
Output values are defined by bilinear interpolation between the pixels.
@ S32
1 channel, 1 S32 per channel
void run() override
Run the kernels contained in the function.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Store the tensor's metadata.
@ F32
1 channel, 1 F32 per channel
bool is_align_corners_allowed_sampling_policy(SamplingPolicy sampling_policy)
Returns if aligned corners are allowed for the given sampling policy.
Copyright (c) 2017-2024 Arm Limited.
float calculate_resize_ratio(size_t input_size, size_t output_size, bool align_corners=false)
Returns resize ratio between input and output with consideration of aligned corners.
@ NEAREST_NEIGHBOR
Output values are defined to match the source pixel whose center is nearest to the sample position.
@ UNKNOWN
Unknown data layout.
Store the tensor's metadata.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
SamplingPolicy sampling_policy
Sampling policy used by the interpolation.
#define ARM_COMPUTE_LOG_PARAMS(...)
InterpolationPolicy interpolation_policy
Interpolation type to use.