OpenNE kernel to fuse the batch normalization node to a preceding convolution node.
More...
|
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...
|
|
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...
|
|
virtual size_t | get_mws (const CPUInfo &platform, size_t thread_count) const |
| Return minimum workload size of the relevant kernel. More...
|
|
| 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...
|
|
bool | is_window_configured () const |
| Function to check if the embedded window of this kernel has been configured. More...
|
|
OpenNE kernel to fuse the batch normalization node to a preceding convolution node.
Definition at line 35 of file NEFuseBatchNormalizationKernel.h.
Set the source, destination of the kernel.
- Parameters
-
[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 |
- Note
- if nullptr, bn_beta is set to 0.0
- Parameters
-
[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 |
- Note
- if nullptr, bn_gamma is set to 1.0
- Parameters
-
[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 236 of file NEFuseBatchNormalizationKernel.cpp.
249 _input_weights = input_weights;
250 _input_bias = input_bias;
254 _bn_gamma = bn_gamma;
255 _fused_weights = fused_weights;
256 _fused_bias = fused_bias;
259 _run_in_place_weights = (fused_weights ==
nullptr) || (fused_weights == input_weights);
260 _run_in_place_bias = (fused_bias ==
nullptr) || (input_bias !=
nullptr && fused_bias == input_bias);
263 if (_fused_weights !=
nullptr)
268 if (_fused_bias !=
nullptr)
276 input_weights->info(), bn_mean->info(), bn_var->info(),
277 (fused_weights !=
nullptr) ? fused_weights->info() :
nullptr,
278 (fused_bias !=
nullptr) ? fused_bias->info() :
nullptr, (input_bias !=
nullptr) ? input_bias->info() :
nullptr,
279 (bn_beta !=
nullptr) ? bn_beta->info() :
nullptr, (bn_gamma !=
nullptr) ? bn_gamma->info() :
nullptr,
epsilon,
282 const auto *uk = get_implementation(FuseBatchNormalizeSelectorData{
290 INEKernel::configure(win);
References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), arm_compute::calculate_max_window(), ICloneable< T >::clone(), ITensorInfo::data_layout(), arm_compute::test::validation::data_type, arm_compute::quantization::epsilon, fbn_type, CPUInfo::get(), CPUInfo::get_isa(), ITensor::info(), and arm_compute::cpu::kernels::validate_arguments().
Static function to check if given info will lead to a valid configuration of NEFuseBatchNormalizationKernel.
- Parameters
-
[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 |
- Note
- if nullptr, bn_beta is set to 0.0
- Parameters
-
[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 |
- Note
- if nullptr, bn_gamma is set to 1.0
- Parameters
-
[in] | epsilon | (Optional) Batch normalization layer epsilon parameter. Defaults to 0.001f. |
[in] | fbn_type | (Optional) Fused batch normalization type. Defaults to CONVOLUTION. |
- Returns
- a status
Definition at line 293 of file NEFuseBatchNormalizationKernel.cpp.
References ARM_COMPUTE_RETURN_ON_ERROR, arm_compute::quantization::epsilon, fbn_type, and arm_compute::cpu::kernels::validate_arguments().
Referenced by NEFuseBatchNormalization::validate().