Compute Library
 21.02
CLPixelWiseMultiplication Class Reference

Basic function to run CLPixelWiseMultiplicationKernel. 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 CLPixelWiseMultiplicationKernel.

Definition at line 149 of file CLPixelWiseMultiplication.h.

Constructor & Destructor Documentation

◆ CLPixelWiseMultiplication() [1/3]

Default Constructor.

Definition at line 136 of file CLPixelWiseMultiplication.cpp.

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

137  : _impl(std::make_unique<Impl>())
138 {
139 }

◆ ~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 configurations (Input1,Input2) -> Output :

  • (U8,U8) -> U8
  • (U8,U8) -> S16
  • (U8,S16) -> S16
  • (S16,U8) -> S16
  • (S16,S16) -> S16
  • (F16,F16) -> F16
  • (F32,F32) -> F32
  • (QASYMM8,QASYMM8) -> QASYMM8
  • (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED
  • (QSYMM16,QSYMM16) -> QSYMM16
  • (QSYMM16,QSYMM16) -> S32
Parameters
[in,out]input1An input tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. 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. 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.
[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 144 of file CLPixelWiseMultiplication.cpp.

References CLKernelLibrary::get().

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

146 {
147  configure(CLKernelLibrary::get().get_compile_context(), input1, input2, output, scale, overflow_policy, rounding_policy, act_info);
148 }
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.

Valid configurations (Input1,Input2) -> Output :

  • (U8,U8) -> U8
  • (U8,U8) -> S16
  • (U8,S16) -> S16
  • (S16,U8) -> S16
  • (S16,S16) -> S16
  • (F16,F16) -> F16
  • (F32,F32) -> F32
  • (QASYMM8,QASYMM8) -> QASYMM8
  • (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED
  • (QSYMM16,QSYMM16) -> QSYMM16
  • (QSYMM16,QSYMM16) -> S32
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. 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. 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.
[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 150 of file CLPixelWiseMultiplication.cpp.

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

152 {
153  _impl->src_0 = input1;
154  _impl->src_1 = input2;
155  _impl->dst = output;
156  _impl->op = std::make_unique<experimental::CLPixelWiseMultiplication>();
157  _impl->op->configure(compile_context, input1->info(), input2->info(), output->info(), scale, overflow_policy, rounding_policy, act_info);
158 }

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

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

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

167 {
168  ITensorPack pack;
169  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
170  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
171  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
172 
173  _impl->op->run(pack);
174 }

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

Valid configurations (Input1,Input2) -> Output :

  • (U8,U8) -> U8
  • (U8,U8) -> S16
  • (U8,S16) -> S16
  • (S16,U8) -> S16
  • (S16,S16) -> S16
  • (F16,F16) -> F16
  • (F32,F32) -> F32
  • (QASYMM8,QASYMM8) -> QASYMM8
  • (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED
  • (QSYMM16,QSYMM16) -> QSYMM16
  • (QSYMM16,QSYMM16) -> S32
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 160 of file CLPixelWiseMultiplication.cpp.

References CLPixelWiseMultiplication::validate().

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

162 {
163  return experimental::CLPixelWiseMultiplication::validate(input1, input2, output, scale, overflow_policy, rounding_policy, act_info);
164 }
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 CLPixelWiseMultiplicatio...

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