Compute Library
 21.02
NEPixelWiseMultiplication Class Reference

Basic function to run NEPixelWiseMultiplicationKernel. More...

#include <NEPixelWiseMultiplication.h>

Collaboration diagram for NEPixelWiseMultiplication:
[legend]

Public Member Functions

 NEPixelWiseMultiplication ()
 Default Constructor. More...
 
 ~NEPixelWiseMultiplication ()
 Default Destructor. More...
 
 NEPixelWiseMultiplication (const NEPixelWiseMultiplication &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEPixelWiseMultiplication (NEPixelWiseMultiplication &&)
 Default move constructor. More...
 
NEPixelWiseMultiplicationoperator= (const NEPixelWiseMultiplication &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEPixelWiseMultiplicationoperator= (NEPixelWiseMultiplication &&)
 Default move assignment operator. More...
 
void configure (const ITensor *input1, const ITensor *input2, ITensor *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 NEPixelWiseMultiplication. More...
 

Detailed Description

Basic function to run NEPixelWiseMultiplicationKernel.

Definition at line 136 of file NEPixelWiseMultiplication.h.

Constructor & Destructor Documentation

◆ NEPixelWiseMultiplication() [1/3]

Default Constructor.

Definition at line 73 of file NEPixelWiseMultiplication.cpp.

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

74  : _impl(std::make_unique<Impl>())
75 {
76 }

◆ ~NEPixelWiseMultiplication()

◆ NEPixelWiseMultiplication() [2/3]

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

◆ NEPixelWiseMultiplication() [3/3]

Default move constructor.

Member Function Documentation

◆ configure()

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

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

Note
For scale equal to 1/255 only round to nearest even (implemented as round half up) is supported. For all other scale values only round to zero (implemented as round towards minus infinity) is supported.
Parameters
[in,out]input1An input tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32 This 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 (only if input1 is QASYMM8), QASYMM8_SIGNED (only if input1 is QASYMM8_SIGNED), S16, S32, QSYMM16 (only if input1 is QSYMM16), F16 (only if input1 is F16), F32 (only if input1 is F32). This input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[out]outputOutput tensor. Data types supported:
  • U8, only if both inputs are U8.
  • QASYMM8, only if both inputs are QASYMM8.
  • QASYMM8_SIGNED, only if input1 is QASYMM8_SIGNED.
  • S16.
  • QSYMM16, only if both inputs are QSYMM16.
  • S32, only if both inputs are S32 or both are QSYMM16.
  • F16, only if input1 is F16.
  • F32, only if both inputs are 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. If both input1, input2 and output are of datatype S32, scale cannot be 1/255
[in]overflow_policyOverflow policy. ConvertPolicy cannot be WRAP if any of the inputs is of quantized datatype
[in]rounding_policyRounding policy.
[in]act_info(Optional) Activation layer information in case of a fused activation. Currently not supported.

Definition at line 87 of file NEPixelWiseMultiplication.cpp.

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

Referenced by NENormalizationLayer::configure(), NELSTMLayerQuantized::configure(), NELSTMLayer::configure(), and NEQLSTMLayer::configure().

89 {
90  _impl->src_0 = input1;
91  _impl->src_1 = input2;
92  _impl->dst = output;
93  _impl->op = std::make_unique<experimental::NEPixelWiseMultiplication>();
94  _impl->op->configure(input1->info(), input2->info(), output->info(), scale, overflow_policy, rounding_policy, act_info);
95 }

◆ operator=() [1/2]

NEPixelWiseMultiplication& operator= ( const NEPixelWiseMultiplication )
delete

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

Referenced by NEPixelWiseMultiplication::NEPixelWiseMultiplication().

◆ 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 97 of file NEPixelWiseMultiplication.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 NENormalizationLayer::run(), NELSTMLayerQuantized::run(), NELSTMLayer::run(), and NEQLSTMLayer::run().

98 {
99  ITensorPack pack;
100  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
101  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
102  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
103  _impl->op->run(pack);
104 }

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

Note
For scale equal to 1/255 only round to nearest even (implemented as round half up) is supported. For all other scale values only round to zero (implemented as round towards minus infinity) is supported.
Parameters
[in]input1An input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32
[in]input2An input tensor info. Data types supported: U8, QASYMM8 (only if input1 is QASYMM8), QASYMM8_SIGNED (only if input1 is QASYMM8_SIGNED), S16, S32, QSYMM16 (only if both inputs are QSYMM16), F16 (only if input1 is F16), F32 (only if input1 is F32).
[in]outputOutput tensor info. Data types supported:
  • U8, only if both inputs are U8.
  • QASYMM8, only if both inputs are QASYMM8.
  • QASYMM8_SIGNED, only if input1 is QASYMM8_SIGNED.
  • S16.
  • QSYMM16, only if both inputs are QSYMM16.
  • S32, only if both inputs are S32 or both are QSYMM16.
  • F16, only if input1 is F16.
  • F32, only if both inputs are 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. If both input1, input2 and output are of datatype S32, scale cannot be 1/255
[in]overflow_policyOverflow policy. ConvertPolicy cannot be WRAP if any of the inputs is of quantized datatype
[in]rounding_policyRounding policy.
[in]act_info(Optional) Activation layer information in case of a fused activation. Currently not supported.
Returns
a status

Definition at line 81 of file NEPixelWiseMultiplication.cpp.

References NEPixelWiseMultiplication::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), NENormalizationLayer::validate(), NELSTMLayerQuantized::validate(), NELSTMLayer::validate(), and NEQLSTMLayer::validate().

83 {
84  return experimental::NEPixelWiseMultiplication::validate(input1, input2, output, scale, overflow_policy, rounding_policy, act_info);
85 }
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 NEPixelWiseMultiplicatio...

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