Compute Library
 21.02
NEPixelWiseMultiplication Class Reference

Basic function to run NEPixelWiseMultiplicationKernel. More...

#include <NEPixelWiseMultiplication.h>

Collaboration diagram for NEPixelWiseMultiplication:
[legend]

Public Member Functions

void configure (ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Initialise the kernel's inputs, output and convertion policy. More...
 
- Public Member Functions inherited from INEOperator
 INEOperator (IRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 INEOperator (const INEOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 INEOperator (INEOperator &&)=default
 Default move constructor. More...
 
INEOperatoroperator= (const INEOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
INEOperatoroperator= (INEOperator &&)=default
 Default move assignment operator. More...
 
 ~INEOperator ()
 Default destructor. More...
 
void run (ITensorPack &tensors) override
 Run the kernels contained in the function. More...
 
void prepare (ITensorPack &constants) override
 Prepare the function for executing. More...
 
MemoryRequirements workspace () const override
 Return the memory requirements required by the workspace. More...
 
- Public Member Functions inherited from IOperator
virtual ~IOperator ()=default
 Destructor. 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 39 of file NEPixelWiseMultiplication.h.

Member Function Documentation

◆ configure()

void configure ( ITensorInfo input1,
ITensorInfo input2,
ITensorInfo 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 :

                                                  Support: Broadcast? Scale=1/255?
  • (U8,U8) -> U8, S16 N Y
  • (U8,S16) -> S16 N Y
  • (S16,U8) -> S16 N Y
  • (S16,S16) -> S16 N Y
  • (S32,S32) -> S32 Y N
  • (F16,F16) -> F16 N Y
  • (F32,F32) -> F32 Y Y
  • (QASYMM8,QASYMM8) -> QASYMM8 Y Y
  • (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED Y Y
  • (QSYMM16,QSYMM16) -> QSYMM16, S32 N Y
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]input1First 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]input2Second 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.
[out]outputOutput 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. 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 35 of file NEPixelWiseMultiplication.cpp.

References ARM_COMPUTE_UNUSED.

37 {
38  ARM_COMPUTE_UNUSED(act_info);
39  auto k = std::make_unique<NEPixelWiseMultiplicationKernel>();
40  k->configure(input1, input2, output, scale, overflow_policy, rounding_policy);
41  _kernel = std::move(k);
42 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

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

Valid configurations (Input1,Input2) -> Output :

                                                  Support: Broadcast? Scale=1/255?
  • (U8,U8) -> U8, S16 N Y
  • (U8,S16) -> S16 N Y
  • (S16,U8) -> S16 N Y
  • (S16,S16) -> S16 N Y
  • (S32,S32) -> S32 Y N
  • (F16,F16) -> F16 N Y
  • (F32,F32) -> F32 Y Y
  • (QASYMM8,QASYMM8) -> QASYMM8 Y Y
  • (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED Y Y
  • (QSYMM16,QSYMM16) -> QSYMM16, S32 N Y
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]input1First input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32
[in]input2Second input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32
[in]outputOutput tensor info. 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. 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 43 of file NEPixelWiseMultiplication.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON, ActivationLayerInfo::enabled(), and NEPixelWiseMultiplicationKernel::validate().

Referenced by NEPixelWiseMultiplication::validate().

45 {
46  ARM_COMPUTE_RETURN_ERROR_ON(act_info.enabled());
47  return NEPixelWiseMultiplicationKernel::validate(input1, input2, output, scale, overflow_policy, rounding_policy);
48 }
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Definition: Error.h:296
static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy)
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: