21.02
|
Basic function to run CLNormalizationLayerKernel and simulate a batch normalization layer. More...
#include <CLBatchNormalizationLayer.h>
Public Member Functions | |
CLBatchNormalizationLayer () | |
Default constructor. More... | |
CLBatchNormalizationLayer (const CLBatchNormalizationLayer &)=delete | |
Prevent instances of this class from being copied. More... | |
CLBatchNormalizationLayer & | operator= (const CLBatchNormalizationLayer &)=delete |
Prevent instances of this class from being copied. More... | |
CLBatchNormalizationLayer (CLBatchNormalizationLayer &&)=delete | |
Prevent instances of this class to be moved. More... | |
CLBatchNormalizationLayer & | operator= (CLBatchNormalizationLayer &&)=delete |
Prevent instances of this class to be moved. More... | |
~CLBatchNormalizationLayer () | |
Default destructor. 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 | configure (const CLCompileContext &compile_context, 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... | |
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 *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 46 of file CLBatchNormalizationLayer.h.
Default constructor.
Definition at line 37 of file CLBatchNormalizationLayer.cpp.
References CLBatchNormalizationLayer::~CLBatchNormalizationLayer().
|
delete |
Prevent instances of this class from being copied.
|
delete |
Prevent instances of this class to be moved.
|
default |
Default destructor.
Referenced by CLBatchNormalizationLayer::CLBatchNormalizationLayer().
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: F16/F32. Data layouts supported: NCHW/NHWC. |
[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. |
Definition at line 44 of file CLBatchNormalizationLayer.cpp.
References CLKernelLibrary::get().
void configure | ( | const CLCompileContext & | compile_context, |
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] | compile_context | The compile context to be used. |
[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: F16/F32. Data layouts supported: NCHW/NHWC. |
[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. |
Definition at line 50 of file CLBatchNormalizationLayer.cpp.
|
delete |
Prevent instances of this class from being copied.
|
delete |
Prevent instances of this class to be moved.
|
overridevirtual |
Run the kernels contained in the function.
For Neon kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 65 of file CLBatchNormalizationLayer.cpp.
References CLScheduler::enqueue(), and CLScheduler::get().
|
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: F16/F32. Data layouts supported: NCHW/NHWC. |
[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. |
Definition at line 57 of file CLBatchNormalizationLayer.cpp.
References CLBatchNormalizationLayerKernel::validate().
Referenced by arm_compute::test::validation::DATA_TEST_CASE().