Compute Library
 20.02.1
CLScale Class Reference

Basic function to run CLScaleKernel. More...

#include <CLScale.h>

Collaboration diagram for CLScale:
[legend]

Public Member Functions

void configure (ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value=PixelValue(), SamplingPolicy sampling_policy=SamplingPolicy::CENTER, bool use_padding=true, bool align_corners=false)
 Initialize the function's source, destination, interpolation type and border_mode. More...
 
- Public Member Functions inherited from ICLSimpleFunction
 ICLSimpleFunction (CLRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ICLSimpleFunction (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ICLSimpleFunction (ICLSimpleFunction &&)=default
 Default move constructor. More...
 
ICLSimpleFunctionoperator= (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLSimpleFunctionoperator= (ICLSimpleFunction &&)=default
 Default move assignment operator. More...
 
void run () override final
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value=PixelValue(), SamplingPolicy sampling_policy=SamplingPolicy::CENTER, bool use_padding=true, bool align_corners=false)
 Static function to check if given info will lead to a valid configuration of CLScale. More...
 

Detailed Description

Basic function to run CLScaleKernel.

Definition at line 37 of file CLScale.h.

Member Function Documentation

◆ configure()

void configure ( ICLTensor input,
ICLTensor output,
InterpolationPolicy  policy,
BorderMode  border_mode,
PixelValue  constant_border_value = PixelValue(),
SamplingPolicy  sampling_policy = SamplingPolicy::CENTER,
bool  use_padding = true,
bool  align_corners = false 
)

Initialize the function's source, destination, interpolation type and border_mode.

Parameters
[in,out]inputSource tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32. (Written to only for border_mode != UNDEFINED)
[out]outputDestination tensor. Data types supported: Same as input All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane.
[in]policyThe interpolation type.
[in]border_modeStrategy to use for borders.
[in]constant_border_value(Optional) Constant value to use for borders if border_mode is set to CONSTANT.
[in]sampling_policy(Optional) Sampling policy used by the interpolation. Defaults to SamplingPolicy::CENTER
[in]use_padding(Optional) Is padding in use or not. Defaults to true.
[in]align_corners(Optional) Align corners of input and output, only affecting bilinear policy with TOP_LEFT sampling policy. Defaults to false.

Definition at line 35 of file CLScale.cpp.

37 {
38  ARM_COMPUTE_UNUSED(use_padding);
39  auto k = arm_compute::support::cpp14::make_unique<CLScaleKernel>();
40  k->set_target(CLScheduler::get().target());
41  k->configure(input, output, policy, border_mode, sampling_policy, align_corners);
42  _kernel = std::move(k);
43 
44  // Tune kernels
46 
47  // In the case of NHWC we can't have undefined border mode as this would require to access elements outside z dimension,
48  // so we treat it like border constant.
49  if(border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC)
50  {
52  }
53  _border_handler.configure(input, _kernel->border_size(), border_mode, constant_border_value);
54 }
static CLScheduler & get()
Access the scheduler singleton.
Definition: CLScheduler.cpp:99
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
Borders are left undefined.
Num samples, height, width, channels.
void tune_kernel_static(ICLKernel &kernel)
Tunes OpenCL kernel.
Definition: CLScheduler.cpp:79

References ARM_COMPUTE_UNUSED, arm_compute::test::validation::border_mode, arm_compute::CONSTANT, CLScheduler::get(), arm_compute::test::validation::input, arm_compute::NHWC, arm_compute::test::validation::policy, CLScheduler::tune_kernel_static(), and arm_compute::UNDEFINED.

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
InterpolationPolicy  policy,
BorderMode  border_mode,
PixelValue  constant_border_value = PixelValue(),
SamplingPolicy  sampling_policy = SamplingPolicy::CENTER,
bool  use_padding = true,
bool  align_corners = false 
)
static

Static function to check if given info will lead to a valid configuration of CLScale.

Parameters
[in]inputSource tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32.
[in]outputOutput tensor info. Data type supported: Same as input All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane.
[in]policyThe interpolation type.
[in]border_modeStrategy to use for borders.
[in]constant_border_value(Optional) Constant value to use for borders if border_mode is set to CONSTANT.
[in]sampling_policy(Optional) Sampling policy used by the interpolation. Defaults to SamplingPolicy::CENTER
[in]use_padding(Optional) Is padding in use or not. Defaults to true.
[in]align_corners(Optional) Align corners of input and output, only affecting bilinear policy with TOP_LEFT sampling policy. Defaults to false.
Returns
a status

Definition at line 56 of file CLScale.cpp.

58 {
59  ARM_COMPUTE_UNUSED(constant_border_value, use_padding);
60  return CLScaleKernel::validate(input, output, policy, border_mode, sampling_policy, align_corners);
61 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
static Status validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy=SamplingPolicy::CENTER, bool align_corners=false)
Static function to check if given info will lead to a valid configuration of CLScaleKernel.

References ARM_COMPUTE_UNUSED, arm_compute::test::validation::border_mode, arm_compute::test::validation::input, arm_compute::test::validation::policy, and CLScaleKernel::validate().


The documentation for this class was generated from the following files: