21.02
|
OpenNE kernel to fuse the batch normalization node to a preceding convolution node. More...
#include <NEFuseBatchNormalizationKernel.h>
Public Member Functions | |
const char * | name () const override |
Name of the kernel. More... | |
NEFuseBatchNormalizationKernel () | |
Default constructor. More... | |
NEFuseBatchNormalizationKernel (const NEFuseBatchNormalizationKernel &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEFuseBatchNormalizationKernel & | operator= (const NEFuseBatchNormalizationKernel &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEFuseBatchNormalizationKernel (NEFuseBatchNormalizationKernel &&)=default | |
Allow instances of this class to be moved. More... | |
NEFuseBatchNormalizationKernel & | operator= (NEFuseBatchNormalizationKernel &&)=default |
Allow instances of this class to be moved. More... | |
~NEFuseBatchNormalizationKernel ()=default | |
Default destructor. More... | |
void | configure (const ITensor *input_weights, const ITensor *bn_mean, const ITensor *bn_var, ITensor *fused_weights, ITensor *fused_bias, const ITensor *input_bias=nullptr, const ITensor *bn_beta=nullptr, const ITensor *bn_gamma=nullptr, float epsilon=0.001f, FuseBatchNormalizationType fbn_type=FuseBatchNormalizationType::CONVOLUTION) |
Set the source, destination of the kernel. More... | |
void | run (const Window &window, const ThreadInfo &info) override |
Execute the kernel on the passed window. More... | |
Public Member Functions inherited from ICPPKernel | |
virtual | ~ICPPKernel ()=default |
Default destructor. More... | |
virtual void | run_nd (const Window &window, const ThreadInfo &info, const Window &thread_locator) |
legacy compatibility layer for implemantions which do not support thread_locator In these cases we simply narrow the interface down the legacy version More... | |
virtual void | run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info) |
Execute the kernel on the passed window. More... | |
Public Member Functions inherited from IKernel | |
IKernel () | |
Constructor. More... | |
virtual | ~IKernel ()=default |
Destructor. More... | |
virtual bool | is_parallelisable () const |
Indicates whether or not the kernel is parallelisable. More... | |
virtual BorderSize | border_size () const |
The size of the border for that kernel. More... | |
const Window & | window () const |
The maximum window the kernel can be executed on. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input_weights, const ITensorInfo *bn_mean, const ITensorInfo *bn_var, const ITensorInfo *fused_weights, const ITensorInfo *fused_bias, const ITensorInfo *input_bias=nullptr, const ITensorInfo *bn_beta=nullptr, const ITensorInfo *bn_gamma=nullptr, float epsilon=0.001f, FuseBatchNormalizationType fbn_type=FuseBatchNormalizationType::CONVOLUTION) |
Static function to check if given info will lead to a valid configuration of NEFuseBatchNormalizationKernel. More... | |
OpenNE kernel to fuse the batch normalization node to a preceding convolution node.
Definition at line 35 of file NEFuseBatchNormalizationKernel.h.
Default constructor.
Definition at line 416 of file NEFuseBatchNormalizationKernel.cpp.
Referenced by NEFuseBatchNormalizationKernel::name().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
default |
Default destructor.
Referenced by NEFuseBatchNormalizationKernel::name().
void configure | ( | const ITensor * | input_weights, |
const ITensor * | bn_mean, | ||
const ITensor * | bn_var, | ||
ITensor * | fused_weights, | ||
ITensor * | fused_bias, | ||
const ITensor * | input_bias = nullptr , |
||
const ITensor * | bn_beta = nullptr , |
||
const ITensor * | bn_gamma = nullptr , |
||
float | epsilon = 0.001f , |
||
FuseBatchNormalizationType | fbn_type = FuseBatchNormalizationType::CONVOLUTION |
||
) |
Set the source, destination of the kernel.
[in] | input_weights | Input weights tensor for convolution or depthwise convolution layer. Data type supported: F16/F32. Data layout supported: NCHW, NHWC |
[in] | bn_mean | Batch normalization layer mean tensor. Same as input_weights |
[in] | bn_var | Batch normalization layer variance tensor. Same as input_weights |
[out] | fused_weights | (Optional) Output fused weights tensor. It can be a nullptr in case of in-place computation. Same as input_weights |
[out] | fused_bias | (Optional) Output fused bias tensor. It can be a nullptr in case of in-place computation and input_bias != nullptr. Same as input_weights |
[in] | input_bias | (Optional) Input bias tensor for convolution or depthwise convolution layer. It can be a nullptr in case the bias tensor is not required. Same as input_weights |
[in] | bn_beta | (Optional) Batch normalization layer beta tensor. It can be a nullptr in case the beta tensor is not required. Same as input_weights |
[in] | bn_gamma | (Optional) Batch normalization layer gamma tensor. It can be a nullptr in case the gamma tensor is not required. Same as input_weights |
[in] | epsilon | (Optional) Batch normalization layer epsilon parameter. Defaults to 0.001f. |
[in] | fbn_type | (Optional) Fused batch normalization type. Defaults to CONVOLUTION. |
Definition at line 422 of file NEFuseBatchNormalizationKernel.cpp.
References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), arm_compute::calculate_max_window(), ICloneable< T >::clone(), arm_compute::CONVOLUTION, ITensorInfo::data_layout(), ITensorInfo::data_type(), arm_compute::quantization::epsilon, ITensor::info(), ITensorInfo::set_valid_region(), arm_compute::string_from_data_layout(), arm_compute::string_from_data_type(), ITensorInfo::valid_region(), and arm_compute::validate_arguments().
Referenced by NEFuseBatchNormalizationKernel::name().
|
inlineoverridevirtual |
Name of the kernel.
Implements ICPPKernel.
Definition at line 38 of file NEFuseBatchNormalizationKernel.h.
References NEFuseBatchNormalizationKernel::configure(), arm_compute::CONVOLUTION, arm_compute::quantization::epsilon, arm_compute::test::validation::info, NEFuseBatchNormalizationKernel::NEFuseBatchNormalizationKernel(), NEFuseBatchNormalizationKernel::operator=(), NEFuseBatchNormalizationKernel::run(), NEFuseBatchNormalizationKernel::validate(), IKernel::window(), and NEFuseBatchNormalizationKernel::~NEFuseBatchNormalizationKernel().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
Referenced by NEFuseBatchNormalizationKernel::name().
|
default |
Allow instances of this class to be moved.
|
overridevirtual |
Execute the kernel on the passed window.
[in] | window | Region on which to execute the kernel. (Must be a region of the window returned by window()) |
[in] | info | Info about executing thread and CPU. |
Reimplemented from ICPPKernel.
Definition at line 507 of file NEFuseBatchNormalizationKernel.cpp.
References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, and IKernel::window().
Referenced by NEFuseBatchNormalizationKernel::name().
|
static |
Static function to check if given info will lead to a valid configuration of NEFuseBatchNormalizationKernel.
[in] | input_weights | Input weights tensor info for convolution or depthwise convolution layer. Data type supported: F16/F32. Data layout supported: NCHW, NHWC |
[in] | bn_mean | Batch normalization layer mean tensor info. Same as input_weights |
[in] | bn_var | Batch normalization layer variance tensor info. Same as input_weights |
[in] | fused_weights | (Optional) Output fused weights tensor info. It can be a nullptr in case of in-place computation. Same as input_weights |
[in] | fused_bias | (Optional) Output fused bias tensor info. It can be a nullptr in case of in-place computation and input_bias != nullptr. Same as input_weights |
[in] | input_bias | (Optional) Input bias tensor info for convolution or depthwise convolution layer. It can be a nullptr in case the bias tensor is not required. Same as input_weights |
[in] | bn_beta | (Optional) Batch normalization layer beta tensor info. It can be a nullptr in case the beta tensor is not required. Same as input_weights |
[in] | bn_gamma | (Optional) Batch normalization layer gamma tensor info. It can be a nullptr in case the gamma tensor is not required. Same as input_weights |
[in] | epsilon | (Optional) Batch normalization layer epsilon parameter. Defaults to 0.001f. |
[in] | fbn_type | (Optional) Fused batch normalization type. Defaults to CONVOLUTION. |
Definition at line 498 of file NEFuseBatchNormalizationKernel.cpp.
References ARM_COMPUTE_RETURN_ON_ERROR, and arm_compute::validate_arguments().
Referenced by NEFuseBatchNormalizationKernel::name(), and NEFuseBatchNormalization::validate().