ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci_interpreter::kernels::LocalResponseNormalization Class Reference

#include <LocalResponseNormalization.h>

Collaboration diagram for luci_interpreter::kernels::LocalResponseNormalization:

Public Member Functions

 LocalResponseNormalization (const Tensor *input, Tensor *output, const LocalResponseNormalizationParams &params)
 
const Tensorinput () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
 LocalResponseNormalization (const Tensor *input, Tensor *output, const LocalResponseNormalizationParams &params)
 
const Tensorinput () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::KernelWithParams< LocalResponseNormalizationParams >
const LocalResponseNormalizationParamsparams () const
 
- Public Member Functions inherited from luci_interpreter::Kernel
virtual ~Kernel ()=default
 
const std::vector< const Tensor * > & getInputTensors () const
 
const std::vector< Tensor * > & getOutputTensors () const
 

Additional Inherited Members

- Protected Member Functions inherited from luci_interpreter::KernelWithParams< LocalResponseNormalizationParams >
 KernelWithParams (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs, const LocalResponseNormalizationParams &params)
 
- Protected Member Functions inherited from luci_interpreter::Kernel
 Kernel (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
 
- Protected Attributes inherited from luci_interpreter::KernelWithParams< LocalResponseNormalizationParams >
const LocalResponseNormalizationParams _params
 
- Protected Attributes inherited from luci_interpreter::Kernel
const std::vector< const Tensor * > _inputs
 
const std::vector< Tensor * > _outputs
 

Detailed Description

Definition at line 28 of file LocalResponseNormalization.h.

Constructor & Destructor Documentation

◆ LocalResponseNormalization() [1/2]

luci_interpreter::kernels::LocalResponseNormalization::LocalResponseNormalization ( const Tensor input,
Tensor output,
const LocalResponseNormalizationParams params 
)

Definition at line 31 of file LocalResponseNormalization.cpp.

33 : KernelWithParams<LocalResponseNormalizationParams>({input}, {output}, params)
34{
35}
const LocalResponseNormalizationParams & params() const
Definition Kernel.h:67

References input().

◆ LocalResponseNormalization() [2/2]

luci_interpreter::kernels::LocalResponseNormalization::LocalResponseNormalization ( const Tensor input,
Tensor output,
const LocalResponseNormalizationParams params 
)

Member Function Documentation

◆ configure() [1/2]

void luci_interpreter::kernels::LocalResponseNormalization::configure ( )
overridevirtual

Implements luci_interpreter::Kernel.

Definition at line 37 of file LocalResponseNormalization.cpp.

38{
39 LUCI_INTERPRETER_CHECK(input()->shape().num_dims() == 4);
40 LUCI_INTERPRETER_CHECK(output()->element_type() == DataType::FLOAT32);
41 LUCI_INTERPRETER_CHECK(input()->element_type() == output()->element_type());
42 output()->resize(input()->shape());
43}
void resize(const Shape &new_shape)
Definition Tensor.cpp:56
#define LUCI_INTERPRETER_CHECK(cond)
Definition Utils.h:36

References input(), LUCI_INTERPRETER_CHECK, output(), and luci_interpreter::Tensor::resize().

◆ configure() [2/2]

void luci_interpreter::kernels::LocalResponseNormalization::configure ( )
overridevirtual

◆ execute() [1/2]

void luci_interpreter::kernels::LocalResponseNormalization::execute ( ) const
overridevirtual

Implements luci_interpreter::Kernel.

Definition at line 45 of file LocalResponseNormalization.cpp.

46{
47 switch (output()->element_type())
48 {
49 case DataType::FLOAT32:
50 tflite::LocalResponseNormalizationParams op_params;
51 op_params.range = params().radius;
52 op_params.bias = params().bias;
53 op_params.alpha = params().alpha;
54 op_params.beta = params().beta;
55 luci_interpreter_pal::LocalResponseNormalization(
56 op_params, getTensorShape(input()), getTensorData<float>(input()), getTensorShape(output()),
57 getTensorData<float>(output()));
58 break;
59 default:
60 throw std::runtime_error("luci-intp LocalResponseNormalizartion Unsupported type.");
61 }
62}
tflite::RuntimeShape getTensorShape(const Tensor *tensor)
Definition Utils.h:194

References luci_interpreter::LocalResponseNormalizationParams::alpha, luci_interpreter::LocalResponseNormalizationParams::beta, luci_interpreter::LocalResponseNormalizationParams::bias, luci_interpreter::kernels::getTensorShape(), input(), output(), luci_interpreter::KernelWithParams< LocalResponseNormalizationParams >::params(), and luci_interpreter::LocalResponseNormalizationParams::radius.

◆ execute() [2/2]

void luci_interpreter::kernels::LocalResponseNormalization::execute ( ) const
overridevirtual

◆ input() [1/2]

const Tensor * luci_interpreter::kernels::LocalResponseNormalization::input ( ) const
inline

Definition at line 34 of file LocalResponseNormalization.h.

34{ return _inputs[0]; }
const std::vector< const Tensor * > _inputs
Definition Kernel.h:52

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), execute(), and LocalResponseNormalization().

◆ input() [2/2]

const Tensor * luci_interpreter::kernels::LocalResponseNormalization::input ( ) const
inline

Definition at line 34 of file LocalResponseNormalization.h.

34{ return _inputs[0]; }

References luci_interpreter::Kernel::_inputs.

◆ output() [1/2]

Tensor * luci_interpreter::kernels::LocalResponseNormalization::output ( ) const
inline

Definition at line 35 of file LocalResponseNormalization.h.

35{ return _outputs[0]; }
const std::vector< Tensor * > _outputs
Definition Kernel.h:53

References luci_interpreter::Kernel::_outputs.

Referenced by configure(), and execute().

◆ output() [2/2]

Tensor * luci_interpreter::kernels::LocalResponseNormalization::output ( ) const
inline

Definition at line 35 of file LocalResponseNormalization.h.

35{ return _outputs[0]; }

References luci_interpreter::Kernel::_outputs.


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