Compute Library
 23.05
ClScale Class Reference

Basic function to simulate a scale layer. More...

#include <ClScale.h>

Collaboration diagram for ClScale:
[legend]

Public Member Functions

 ClScale ()=default
 Constructor. More...
 
void configure (const CLCompileContext &compile_context, ITensorInfo *src, ITensorInfo *dst, const ScaleKernelInfo &info)
 Initialize the function's source, destination, interpolation type and border_mode. More...
 
void run (ITensorPack &tensors) override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from ICLOperator
 ICLOperator (IRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ICLOperator (const ICLOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ICLOperator (ICLOperator &&)=default
 Default move constructor. More...
 
ICLOperatoroperator= (const ICLOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLOperatoroperator= (ICLOperator &&)=default
 Default move assignment operator. More...
 
void prepare (ITensorPack &constants) override
 Prepare the function for executing. More...
 
MemoryRequirements workspace () const override
 Return the memory requirements required by the workspace. More...
 
- Public Member Functions inherited from IOperator
virtual ~IOperator ()=default
 Destructor. More...
 

Static Public Member Functions

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. More...
 

Detailed Description

Basic function to simulate a scale layer.

This function calls the following OpenCL kernels:

  1. kernels::ClScaleKernel

Definition at line 39 of file ClScale.h.

Constructor & Destructor Documentation

◆ ClScale()

ClScale ( )
default

Constructor.

Member Function Documentation

◆ configure()

void configure ( const CLCompileContext compile_context,
ITensorInfo src,
ITensorInfo dst,
const ScaleKernelInfo info 
)

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

Parameters
[in]compile_contextThe compile context to be used.
[in,out]srcSource tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/F32. (Written to only for border_mode != UNDEFINED)
[out]dstDestination tensor info. Data types supported: Same as src 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]infoScaleKernelInfo descriptor to be used to configure

Definition at line 38 of file ClScale.cpp.

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_LOG_PARAMS, CLScheduler::get(), arm_compute::test::validation::k, and CLScheduler::tune_kernel_static().

39 {
42 
43  // Configure Scale kernel
44  auto k = std::make_unique<kernels::ClScaleKernel>();
45  k->set_target(CLScheduler::get().target());
46  k->configure(compile_context, src, dst, info);
47  _kernel = std::move(k);
48 
49  // Tune kernel
51 }
static CLScheduler & get()
Access the scheduler singleton.
SimpleTensor< float > src
Definition: DFT.cpp:155
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#define ARM_COMPUTE_LOG_PARAMS(...)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157
void tune_kernel_static(ICLKernel &kernel)
Tunes OpenCL kernel.
Definition: CLScheduler.cpp:82

◆ run()

void run ( ITensorPack tensors)
overridevirtual

Run the kernels contained in the function.

Parameters
[in]tensorsVector that contains the tensors to operate on.

Reimplemented from ICLOperator.

Definition at line 58 of file ClScale.cpp.

References ARM_COMPUTE_ERROR_ON_MSG, ITensorPack::empty(), CLScheduler::enqueue_op(), and CLScheduler::get().

59 {
60  ARM_COMPUTE_ERROR_ON_MSG(tensors.empty(), "No inputs provided");
61  CLScheduler::get().enqueue_op(*_kernel.get(), tensors);
62 }
static CLScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456
void enqueue_op(ICLKernel &kernel, ITensorPack &tensors, bool flush=true)
Schedule the execution of the passed kernel if possible.

◆ validate()

Status validate ( const ITensorInfo src,
const ITensorInfo dst,
const ScaleKernelInfo info 
)
static

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

Similar to ClScale::configure()

Returns
a status

Definition at line 53 of file ClScale.cpp.

References ClScaleKernel::validate().

Referenced by CLScale::validate().

54 {
56 }
SimpleTensor< float > src
Definition: DFT.cpp:155
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.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

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