Compute Library
 19.08
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)
 Initialize the function's source, destination, interpolation type and border_mode. More...
 
- Public Member Functions inherited from ICLSimpleFunction
 ICLSimpleFunction ()
 Default constructor. 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)
 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 
)

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

Parameters
[in,out]inputSource tensor. Data types supported: U8/QASYMM8/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

Definition at line 35 of file CLScale.cpp.

36 {
37  auto k = arm_compute::support::cpp14::make_unique<CLScaleKernel>();
38  k->set_target(CLScheduler::get().target());
39  k->configure(input, output, policy, border_mode, sampling_policy);
40  _kernel = std::move(k);
41 
42  // Tune kernels
44 
45  // In the case of NHWC we can't have undefined border mode as this would require to access elements outside z dimension,
46  // so we treat it like border constant.
48  {
50  }
51  _border_handler.configure(input, _kernel->border_size(), border_mode, constant_border_value);
52 }
static CLScheduler & get()
Access the scheduler singleton.
Definition: CLScheduler.cpp:41
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Borders are left undefined.
Num samples, height, width, channels.
void tune_kernel_static(ICLKernel &kernel)
Tunes OpenCL kernel.
Definition: CLScheduler.h:172
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.

References arm_compute::test::validation::border_mode, arm_compute::CONSTANT, ITensorInfo::data_layout(), CLScheduler::get(), ITensor::info(), 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 
)
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/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
Returns
a status

Definition at line 54 of file CLScale.cpp.

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

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


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