ONE - On-device Neural Engine
Loading...
Searching...
No Matches
arm_compute::NEInstanceNormalizationLayerKernelEx Class Reference

#include <NEInstanceNormalizationLayerKernelEx.h>

Collaboration diagram for arm_compute::NEInstanceNormalizationLayerKernelEx:

Public Member Functions

const char * name () const override
 
 NEInstanceNormalizationLayerKernelEx ()
 
 NEInstanceNormalizationLayerKernelEx (const NEInstanceNormalizationLayerKernelEx &)=delete
 
NEInstanceNormalizationLayerKernelExoperator= (const NEInstanceNormalizationLayerKernelEx &)=delete
 
 NEInstanceNormalizationLayerKernelEx (NEInstanceNormalizationLayerKernelEx &&)=default
 
NEInstanceNormalizationLayerKernelExoperator= (NEInstanceNormalizationLayerKernelEx &&)=default
 
 ~NEInstanceNormalizationLayerKernelEx ()=default
 
void configure (ITensor *input, ITensor *output, ITensor *gamma=nullptr, ITensor *beta=nullptr, float epsilon=1e-12f)
 
void run (const Window &window, const ThreadInfo &info) override
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *gamma=nullptr, const ITensorInfo *beta=nullptr, float epsilon=1e-12f)
 

Detailed Description

Interface for performing an instance normalization

Definition at line 51 of file NEInstanceNormalizationLayerKernelEx.h.

Constructor & Destructor Documentation

◆ NEInstanceNormalizationLayerKernelEx() [1/3]

arm_compute::NEInstanceNormalizationLayerKernelEx::NEInstanceNormalizationLayerKernelEx ( )

Default constructor

Definition at line 241 of file NEInstanceNormalizationLayerKernelEx.cpp.

242 : _func(nullptr), _input(nullptr), _output(nullptr), _gamma(nullptr), _beta(nullptr),
243 _epsilon(1e-12)
244{
245}

◆ NEInstanceNormalizationLayerKernelEx() [2/3]

arm_compute::NEInstanceNormalizationLayerKernelEx::NEInstanceNormalizationLayerKernelEx ( const NEInstanceNormalizationLayerKernelEx )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ NEInstanceNormalizationLayerKernelEx() [3/3]

arm_compute::NEInstanceNormalizationLayerKernelEx::NEInstanceNormalizationLayerKernelEx ( NEInstanceNormalizationLayerKernelEx &&  )
default

Allow instances of this class to be moved

◆ ~NEInstanceNormalizationLayerKernelEx()

arm_compute::NEInstanceNormalizationLayerKernelEx::~NEInstanceNormalizationLayerKernelEx ( )
default

Default destructor

References validate().

Member Function Documentation

◆ configure()

void arm_compute::NEInstanceNormalizationLayerKernelEx::configure ( ITensor *  input,
ITensor *  output,
ITensor *  gamma = nullptr,
ITensor *  beta = nullptr,
float  epsilon = 1e-12f 
)

Set the input and output tensors.

Parameters
[in,out]inputSource tensor. Data types supported: F16/F32. Data layout supported: NCHW In case of output tensor = nullptr this tensor will store the result of the normalization.
[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

Definition at line 247 of file NEInstanceNormalizationLayerKernelEx.cpp.

249{
250 ARM_COMPUTE_ERROR_ON_NULLPTR(input);
251
252 _input = input;
253 _output = output == nullptr ? input : output;
254 _gamma = gamma;
255 _beta = beta;
256 _epsilon = epsilon;
257
258 ARM_COMPUTE_ERROR_THROW_ON(
259 validate_arguments(_input->info(), _output->info(), gamma->info(), beta->info(), epsilon));
260
261 if (_input->info()->data_type() == DataType::F32)
262 {
263 _func = &instance_normalization_nchw<float>;
264 }
265#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
266 else if (_input->info()->data_type() == DataType::F16)
267 {
268 _func = &instance_normalization_nchw<float16_t>;
269 }
270#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
271 else
272 {
273 ARM_COMPUTE_ERROR("Unsupported data type");
274 }
275
276 // Configure kernel window
277 auto win_config = validate_and_configure_window(_input->info(), _output->info());
278 ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config));
279
280 INEKernel::configure(std::get<1>(win_config));
281}

Referenced by arm_compute::NEInstanceNormalizationLayerEx::configure().

◆ name()

const char * arm_compute::NEInstanceNormalizationLayerKernelEx::name ( ) const
inlineoverride

Definition at line 54 of file NEInstanceNormalizationLayerKernelEx.h.

54{ return "NEInstanceNormalizationLayerKernelEx"; }

◆ operator=() [1/2]

NEInstanceNormalizationLayerKernelEx & arm_compute::NEInstanceNormalizationLayerKernelEx::operator= ( const NEInstanceNormalizationLayerKernelEx )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

NEInstanceNormalizationLayerKernelEx & arm_compute::NEInstanceNormalizationLayerKernelEx::operator= ( NEInstanceNormalizationLayerKernelEx &&  )
default

Allow instances of this class to be moved

◆ run()

void arm_compute::NEInstanceNormalizationLayerKernelEx::run ( const Window &  window,
const ThreadInfo &  info 
)
override

Definition at line 294 of file NEInstanceNormalizationLayerKernelEx.cpp.

295{
296 ARM_COMPUTE_UNUSED(info);
297 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
298 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
299 (*_func)(_input, _output, _gamma, _beta, _epsilon, window);
300}
volatile const char info[]

References info.

Referenced by package.infer.session::inference().

◆ validate()

Status arm_compute::NEInstanceNormalizationLayerKernelEx::validate ( const ITensorInfo *  input,
const ITensorInfo *  output,
const ITensorInfo *  gamma = nullptr,
const ITensorInfo *  beta = nullptr,
float  epsilon = 1e-12f 
)
static

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

Parameters
[in]inputSource tensor info. Data types supported: F16/F32. Data layout supported: 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
Returns
a status

Definition at line 283 of file NEInstanceNormalizationLayerKernelEx.cpp.

287{
288 ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, gamma, beta, epsilon));
289 ARM_COMPUTE_RETURN_ON_ERROR(std::get<0>(validate_and_configure_window(
290 input->clone().get(), (output == nullptr ? input->clone().get() : output->clone().get()))));
291 return Status{};
292}
KnobTrait< K >::ValueType get(void)
luci::CircleConst * clone(luci::CircleConst *node)
Return cloned object of CircleConst node.

Referenced by arm_compute::NEInstanceNormalizationLayerEx::validate(), and ~NEInstanceNormalizationLayerKernelEx().


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