Compute Library
 21.11
CLScale Class Reference

Basic function to run opencl::ClScale. More...

#include <CLScale.h>

Collaboration diagram for CLScale:
[legend]

Public Member Functions

 CLScale ()
 Default Constructor. More...
 
 ~CLScale ()
 Default Destructor. More...
 
 CLScale (const CLScale &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLScale (CLScale &&)=default
 Default move constructor. More...
 
CLScaleoperator= (const CLScale &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLScaleoperator= (CLScale &&)=default
 Default move assignment operator. More...
 
void configure (ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
 Initialize the function's source, destination, interpolation type and border_mode. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
 Initialize the function's source, destination, interpolation type and border_mode. More...
 
void run () override
 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, const ScaleKernelInfo &info)
 Static function to check if given info will lead to a valid configuration of CLScale. More...
 

Detailed Description

Basic function to run opencl::ClScale.

Definition at line 40 of file CLScale.h.

Constructor & Destructor Documentation

◆ CLScale() [1/3]

CLScale ( )

Default Constructor.

Definition at line 41 of file CLScale.cpp.

References CLScale::~CLScale().

42  : _impl(std::make_unique<Impl>())
43 {
44 }

◆ ~CLScale()

~CLScale ( )
default

Default Destructor.

Referenced by CLScale::CLScale().

◆ CLScale() [2/3]

CLScale ( const CLScale )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ CLScale() [3/3]

CLScale ( CLScale &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( ICLTensor input,
ICLTensor output,
const ScaleKernelInfo info 
)

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

Valid data layouts:

  • NHWC
  • NCHW

Valid data type configurations:

src dst
QASYMM8 QASYMM8
QASYMM8_SIGNED QASYMM8_SIGNED
F16 F16
F32 F32
U8 U8
S16 S16
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]infoScaleKernelInfo descriptor to be used to configure

Definition at line 47 of file CLScale.cpp.

References CLKernelLibrary::get().

48 {
49  configure(CLKernelLibrary::get().get_compile_context(), input, output, info);
50 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
void configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
Initialize the function&#39;s source, destination, interpolation type and border_mode.
Definition: CLScale.cpp:47

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
ICLTensor input,
ICLTensor output,
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]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]infoScaleKernelInfo descriptor to be used to configure

Definition at line 52 of file CLScale.cpp.

References ITensor::info(), arm_compute::test::validation::info, and arm_compute::test::validation::input.

53 {
54  _impl->src = input;
55  _impl->dst = output;
56 
57  _impl->op = std::make_unique<opencl::ClScale>();
58  _impl->op->configure(compile_context, input->info(), output->info(), info);
59 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator=() [1/2]

CLScale& operator= ( const CLScale )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

CLScale& operator= ( CLScale &&  )
default

Default move assignment operator.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For CPU kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 66 of file CLScale.cpp.

References arm_compute::ACL_DST, arm_compute::ACL_SRC, ITensorPack::add_tensor(), and arm_compute::test::validation::pack.

67 {
68  ITensorPack pack;
69  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
70  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
71  _impl->op->run(pack);
72 }
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const ScaleKernelInfo info 
)
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]infoScaleKernelInfo descriptor to be used to validate
Returns
a status

Definition at line 61 of file CLScale.cpp.

References ClScale::validate().

Referenced by arm_compute::test::validation::TEST_CASE().

62 {
63  return opencl::ClScale::validate(input, output, info);
64 }
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.
Definition: ClScale.cpp:53
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

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