Compute Library
 23.08
CLPixelWiseMultiplication Class Reference

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

#include <CLPixelWiseMultiplication.h>

Collaboration diagram for CLPixelWiseMultiplication:
[legend]

Public Member Functions

 CLPixelWiseMultiplication ()
 Default Constructor. More...
 
 ~CLPixelWiseMultiplication ()
 Default Destructor. More...
 
 CLPixelWiseMultiplication (const CLPixelWiseMultiplication &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLPixelWiseMultiplication (CLPixelWiseMultiplication &&)
 Default move constructor. More...
 
CLPixelWiseMultiplicationoperator= (const CLPixelWiseMultiplication &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLPixelWiseMultiplicationoperator= (CLPixelWiseMultiplication &&)
 Default move assignment operator. More...
 
void configure (ICLTensor *input1, ICLTensor *input2, ICLTensor *output, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Initialise the kernel's inputs, output and convertion policy. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *output, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Initialise the kernel's inputs, output and convertion policy. 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 *input1, const ITensorInfo *input2, const ITensorInfo *output, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Static function to check if given info will lead to a valid configuration of CLPixelWiseMultiplication. More...
 

Detailed Description

Basic function to run opencl::ClMul.

Definition at line 40 of file CLPixelWiseMultiplication.h.

Constructor & Destructor Documentation

◆ CLPixelWiseMultiplication() [1/3]

Default Constructor.

Definition at line 43 of file CLPixelWiseMultiplication.cpp.

44  : _impl(std::make_unique<Impl>())
45 {
46 }

◆ ~CLPixelWiseMultiplication()

Default Destructor.

◆ CLPixelWiseMultiplication() [2/3]

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

◆ CLPixelWiseMultiplication() [3/3]

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const CLCompileContext compile_context,
ICLTensor input1,
ICLTensor input2,
ICLTensor output,
float  scale,
ConvertPolicy  overflow_policy,
RoundingPolicy  rounding_policy,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)

Initialise the kernel's inputs, output and convertion policy.

Parameters
[in]compile_contextThe compile context to be used.
[in,out]input1An input tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32/S32 The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[in,out]input2An input tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32/S32 The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[out]outputThe output tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32/S32
[in]scaleScale to apply after multiplication. Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15.
[in]overflow_policyOverflow policy. Supported overflow policies: Wrap, Saturate
[in]rounding_policyRounding policy. Supported rounding modes: to zero, to nearest even.
[in]act_info(Optional) Activation layer information in case of a fused activation.

Definition at line 57 of file CLPixelWiseMultiplication.cpp.

59 {
60  _impl->src_0 = input1;
61  _impl->src_1 = input2;
62  _impl->dst = output;
63  _impl->op = std::make_unique<opencl::ClMul>();
64  _impl->op->configure(compile_context, input1->info(), input2->info(), output->info(), scale, overflow_policy, rounding_policy, act_info);
65 }

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

◆ configure() [2/2]

void configure ( ICLTensor input1,
ICLTensor input2,
ICLTensor output,
float  scale,
ConvertPolicy  overflow_policy,
RoundingPolicy  rounding_policy,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)

Initialise the kernel's inputs, output and convertion policy.

Valid data layouts:

  • All

Valid data type configurations:

src0 src1 dst
QASYMM8 QASYMM8 QASYMM8
QASYMM8_SIGNED QASYMM8_SIGNED QASYMM8_SIGNED
QSYMM16 QSYMM16 QASYMM16
QSYMM16 QSYMM16 S32
U8 U8 U8
U8 U8 S16
U8 S16 S16
S16 U8 S16
S16 S16 S16
F16 F16 F16
F32 F32 F32
S32 S32 S32
Parameters
[in,out]input1An input tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32/S32 The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[in,out]input2An input tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32/S32 The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[out]outputThe output tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32/S32
[in]scaleScale to apply after multiplication. Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15.
[in]overflow_policyOverflow policy. Supported overflow policies: Wrap, Saturate
[in]rounding_policyRounding policy. Supported rounding modes: to zero, to nearest even.
[in]act_info(Optional) Activation layer information in case of a fused activation.

Definition at line 51 of file CLPixelWiseMultiplication.cpp.

53 {
54  configure(CLKernelLibrary::get().get_compile_context(), input1, input2, output, scale, overflow_policy, rounding_policy, act_info);
55 }

References arm_compute::test::validation::act_info, CLKernelLibrary::get(), and arm_compute::test::validation::scale.

Referenced by CLLSTMLayerQuantized::configure(), CLLSTMLayer::configure(), and CLQLSTMLayer::configure().

◆ operator=() [1/2]

Default move assignment operator.

◆ operator=() [2/2]

CLPixelWiseMultiplication& operator= ( const CLPixelWiseMultiplication )
delete

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

◆ 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 73 of file CLPixelWiseMultiplication.cpp.

74 {
75  ITensorPack pack;
76  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
77  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
78  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
79 
80  _impl->op->run(pack);
81 }

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

Referenced by CLLSTMLayerQuantized::run(), CLLSTMLayer::run(), and CLQLSTMLayer::run().

◆ validate()

Status validate ( const ITensorInfo input1,
const ITensorInfo input2,
const ITensorInfo output,
float  scale,
ConvertPolicy  overflow_policy,
RoundingPolicy  rounding_policy,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)
static

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

Parameters
[in]input1An input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32.
[in]input2An input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32.
[in]outputThe output tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32.
[in]scaleScale to apply after multiplication. Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15.
[in]overflow_policyOverflow policy. Supported overflow policies: Wrap, Saturate
[in]rounding_policyRounding policy. Supported rounding modes: to zero, to nearest even.
[in]act_info(Optional) Activation layer information in case of a fused activation.
Returns
a status

Definition at line 67 of file CLPixelWiseMultiplication.cpp.

69 {
70  return opencl::ClMul::validate(input1, input2, output, scale, overflow_policy, rounding_policy, act_info);
71 }

References arm_compute::test::validation::act_info, arm_compute::test::validation::scale, and ClMul::validate().

Referenced by CLLSTMLayerQuantized::validate(), CLLSTMLayer::validate(), and CLQLSTMLayer::validate().


The documentation for this class was generated from the following files:
arm_compute::CLPixelWiseMultiplication::configure
void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Initialise the kernel's inputs, output and convertion policy.
Definition: CLPixelWiseMultiplication.cpp:51
arm_compute::ITensorPack::add_tensor
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39
arm_compute::ACL_SRC_0
@ ACL_SRC_0
Definition: Types.h:45
arm_compute::ACL_SRC_1
@ ACL_SRC_1
Definition: Types.h:46
arm_compute::CLKernelLibrary::get
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Definition: CLKernelLibrary.cpp:39
arm_compute::test::validation::act_info
act_info
Definition: DirectConvolutionLayer.cpp:547
arm_compute::ACL_DST
@ ACL_DST
Definition: Types.h:55
arm_compute::opencl::ClMul::validate
static Status validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Static function to check if given info will lead to a valid configuration.
Definition: ClMul.cpp:45
arm_compute::test::validation::pack
ITensorPack pack
Definition: Im2Col.cpp:188
arm_compute::test::validation::scale
NEScale scale
Definition: Scale.cpp:272