Compute Library
 22.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 38 of file CLPixelWiseMultiplication.h.

Constructor & Destructor Documentation

◆ CLPixelWiseMultiplication() [1/3]

Default Constructor.

Definition at line 43 of file CLPixelWiseMultiplication.cpp.

References CLPixelWiseMultiplication::operator=(), and CLPixelWiseMultiplication::~CLPixelWiseMultiplication().

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

◆ ~CLPixelWiseMultiplication()

◆ 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 ( 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.

References CLKernelLibrary::get().

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

53 {
54  configure(CLKernelLibrary::get().get_compile_context(), input1, input2, output, scale, overflow_policy, rounding_policy, act_info);
55 }
void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Initialise the kernel&#39;s inputs, output and convertion policy.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.

◆ configure() [2/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.

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

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 }

◆ operator=() [1/2]

CLPixelWiseMultiplication& operator= ( const CLPixelWiseMultiplication )
delete

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

Referenced by CLPixelWiseMultiplication::CLPixelWiseMultiplication().

◆ operator=() [2/2]

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

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

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

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 }
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39

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

References ClMul::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), CLLSTMLayerQuantized::validate(), CLLSTMLayer::validate(), and CLQLSTMLayer::validate().

69 {
70  return opencl::ClMul::validate(input1, input2, output, scale, overflow_policy, rounding_policy, act_info);
71 }
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

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