Compute Library
18.05
|
Basic function to run CLNormalizationLayerKernel and simulate a batch normalization layer. More...
#include <CLBatchNormalizationLayer.h>
Public Member Functions | |
CLBatchNormalizationLayer () | |
Default constructor. More... | |
void | configure (ICLTensor *input, ICLTensor *output, const ICLTensor *mean, const ICLTensor *var, const ICLTensor *beta=nullptr, const ICLTensor *gamma=nullptr, float epsilon=0.001f, ActivationLayerInfo act_info=ActivationLayerInfo()) |
Set the input and output tensors. More... | |
void | run () override |
Run the kernels contained in the function. More... | |
![]() | |
virtual | ~IFunction ()=default |
Destructor. More... | |
virtual void | prepare () |
Prepare the function for executing. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *mean, const ITensorInfo *var, const ITensorInfo *beta=nullptr, const ITensorInfo *gamma=nullptr, float epsilon=0.001f, ActivationLayerInfo act_info=ActivationLayerInfo()) |
Static function to check if given info will lead to a valid configuration of CLBatchNormalizationLayer. More... | |
Basic function to run CLNormalizationLayerKernel and simulate a batch normalization layer.
Batch normalization is calculated by:
\[ out_i = \gamma * (\frac{in_i - \mu_{B}}{\sqrt{\sigma^2_{B} + \epsilon}}) + \beta \equiv BN_{\gamma,\beta}(in_i) \]
Definition at line 42 of file CLBatchNormalizationLayer.h.
Default constructor.
void configure | ( | ICLTensor * | input, |
ICLTensor * | output, | ||
const ICLTensor * | mean, | ||
const ICLTensor * | var, | ||
const ICLTensor * | beta = nullptr , |
||
const ICLTensor * | gamma = nullptr , |
||
float | epsilon = 0.001f , |
||
ActivationLayerInfo | act_info = ActivationLayerInfo() |
||
) |
Set the input and output tensors.
[in,out] | input | Source tensor. In case of output tensor = nullptr, this tensor will store the result. 3 lower dimensions represent a single input with dimensions [width, height, FM]. The rest are optional and used for representing batches. Data types supported: QS8/QS16/F16/F32. |
[out] | output | Destination tensor. Output will have the same number of dimensions as input. Data type supported: same as input |
[in] | mean | Mean values tensor. 1 dimension with size equal to the feature maps [FM]. Data types supported: Same as input |
[in] | var | Variance values tensor. 1 dimension with size equal to the feature maps [FM]. Data types supported: Same as input |
[in] | beta | (Optional) Beta values tensor info. 1 dimension with size equal to the feature maps [FM]. If not provided, default value for beta is 0. Data types supported: Same as input |
[in] | gamma | (Optional) Gamma values tensor info. 1 dimension with size equal to the feature maps [FM]. If not provided, default value for gamma is 1. Data types supported: Same as input |
[in] | epsilon | (Optional) Small value to avoid division with zero. Default value is 0.001f. |
[in] | act_info | (Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU supported. |
|
overridevirtual |
Run the kernels contained in the function.
For NEON kernels:
For OpenCL kernels:
Implements IFunction.
|
static |
Static function to check if given info will lead to a valid configuration of CLBatchNormalizationLayer.
[in] | input | Source tensor info. In case of output tensor info = nullptr, this tensor will store the result. 3 lower dimensions represent a single input with dimensions [width, height, FM]. The rest are optional and used for representing batches. Data types supported: QS8/QS16/F16/F32. |
[in] | output | Destination tensor info. Output will have the same number of dimensions as input. Data type supported: same as input |
[in] | mean | Mean values tensor info. 1 dimension with size equal to the feature maps [FM]. Data types supported: Same as input |
[in] | var | Variance values tensor info. 1 dimension with size equal to the feature maps [FM]. Data types supported: Same as input |
[in] | beta | (Optional) Beta values tensor info. 1 dimension with size equal to the feature maps [FM]. If not provided, default value for beta is 0. Data types supported: Same as input |
[in] | gamma | (Optional) Gamma values tensor info. 1 dimension with size equal to the feature maps [FM]. If not provided, default value for gamma is 1. Data types supported: Same as input |
[in] | epsilon | (Optional) Small value to avoid division with zero. Default value is 0.001f. |
[in] | act_info | (Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU supported. |
Referenced by arm_compute::test::validation::DATA_TEST_CASE().