Compute Library
 21.02
CLInstanceNormalizationLayer Class Reference

Basic function to perform a Instance normalization. More...

#include <CLInstanceNormalizationLayer.h>

Collaboration diagram for CLInstanceNormalizationLayer:
[legend]

Public Member Functions

 CLInstanceNormalizationLayer ()
 Default constructor. More...
 
void configure (ICLTensor *input, ICLTensor *output, float gamma=1.0f, float beta=0.0f, float epsilon=1e-12f, bool use_mixed_precision=true)
 Set the input and output tensors. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, float gamma=1.0f, float beta=0.0f, float epsilon=1e-12f, bool use_mixed_precision=true)
 Set the input and output tensors. More...
 
- Public Member Functions inherited from ICLSimpleFunction
 ICLSimpleFunction (CLRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ICLSimpleFunction (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ICLSimpleFunction (ICLSimpleFunction &&)=default
 Default move constructor. More...
 
ICLSimpleFunctionoperator= (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLSimpleFunctionoperator= (ICLSimpleFunction &&)=default
 Default move assignment operator. More...
 
 ~ICLSimpleFunction ()
 Default destructor. More...
 
void run () override final
 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, float gamma=1.0f, float beta=0.0f, float epsilon=1e-12f, bool use_mixed_precision=true)
 Static function to check if given info will lead to a valid configuration of CLInstanceNormalizationLayer. More...
 

Detailed Description

Basic function to perform a Instance normalization.

This function runs the following kernels:

  1. CLInstanceNormalizationLayerKernel

Definition at line 41 of file CLInstanceNormalizationLayer.h.

Constructor & Destructor Documentation

◆ CLInstanceNormalizationLayer()

Default constructor.

Definition at line 32 of file CLInstanceNormalizationLayer.cpp.

33 {
34 }

Member Function Documentation

◆ configure() [1/2]

void configure ( ICLTensor input,
ICLTensor output,
float  gamma = 1.0f,
float  beta = 0.0f,
float  epsilon = 1e-12f,
bool  use_mixed_precision = true 
)

Set the input and output tensors.

Parameters
[in,out]inputSource tensor. In case of output tensor = nullptr this tensor will store the result of the normalization. Data types supported: F16/F32. Data layout supported: NHWC, NCHW
[out]outputDestination tensor. Data types and data layouts supported: same as input.
[in]gamma(Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
[in]beta(Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
[in]epsilon(Optional) Lower bound value for the normalization. Defaults to 1e-12
[in]use_mixed_precision(Optional) Use mixed precision in case of FP16 execution

Definition at line 36 of file CLInstanceNormalizationLayer.cpp.

References CLKernelLibrary::get().

37 {
38  configure(CLKernelLibrary::get().get_compile_context(), input, output, gamma, beta, epsilon, use_mixed_precision);
39 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(ICLTensor *input, ICLTensor *output, float gamma=1.0f, float beta=0.0f, float epsilon=1e-12f, bool use_mixed_precision=true)
Set the input and output tensors.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
ICLTensor input,
ICLTensor output,
float  gamma = 1.0f,
float  beta = 0.0f,
float  epsilon = 1e-12f,
bool  use_mixed_precision = true 
)

Set the input and output tensors.

Parameters
[in]compile_contextThe compile context to be used.
[in,out]inputSource tensor. In case of output tensor = nullptr this tensor will store the result of the normalization. Data types supported: F16/F32. Data layout supported: NHWC, NCHW
[out]outputDestination tensor. Data types and data layouts supported: same as input.
[in]gamma(Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
[in]beta(Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
[in]epsilon(Optional) Lower bound value for the normalization. Defaults to 1e-12
[in]use_mixed_precision(Optional) Use mixed precision in case of FP16 execution

Definition at line 41 of file CLInstanceNormalizationLayer.cpp.

42 {
43  auto k = std::make_unique<CLInstanceNormalizationLayerKernel>();
44  k->configure(compile_context, input, output, InstanceNormalizationLayerKernelInfo(gamma, beta, epsilon, use_mixed_precision));
45  _kernel = std::move(k);
46 }

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
float  gamma = 1.0f,
float  beta = 0.0f,
float  epsilon = 1e-12f,
bool  use_mixed_precision = true 
)
static

Static function to check if given info will lead to a valid configuration of CLInstanceNormalizationLayer.

Parameters
[in]inputSource tensor info. Data types supported: F16/F32. Data layout supported: NHWC, NCHW
[in]outputDestination tensor info. Data types and data layouts supported: same as input.
[in]gamma(Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
[in]beta(Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
[in]epsilon(Optional) Lower bound value for the normalization. Defaults to 1e-12
[in]use_mixed_precision(Optional) Use mixed precision in case of FP16 execution
Returns
a status

Definition at line 48 of file CLInstanceNormalizationLayer.cpp.

References CLInstanceNormalizationLayerKernel::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

49 {
50  return CLInstanceNormalizationLayerKernel::validate(input, output, InstanceNormalizationLayerKernelInfo(gamma, beta, epsilon, use_mixed_precision));
51 }
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const InstanceNormalizationLayerKernelInfo &info)
Static function to check if given info will lead to a valid configuration of CLInstanceNormalizationL...

The documentation for this class was generated from the following files: