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

#include <Gelu.h>

Collaboration diagram for luci_interpreter::kernels::Gelu:

Public Member Functions

 Gelu (const Tensor *input, Tensor *output, const GeluParams &params)
 
const Tensorinput () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::KernelWithParams< GeluParams >
const GeluParamsparams () 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< GeluParams >
 KernelWithParams (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs, const GeluParams &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< GeluParams >
const GeluParams _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 Gelu.h.

Constructor & Destructor Documentation

◆ Gelu()

luci_interpreter::kernels::Gelu::Gelu ( const Tensor input,
Tensor output,
const GeluParams params 
)

Definition at line 31 of file Gelu.cpp.

32 : KernelWithParams<GeluParams>({input}, {output}, params)
33{
34}
const Tensor * input() const
Definition Gelu.h:33
Tensor * output() const
Definition Gelu.h:34

References input().

Member Function Documentation

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 36 of file Gelu.cpp.

37{
38 LUCI_INTERPRETER_CHECK(input()->element_type() == output()->element_type());
39
40 output()->resize(input()->shape());
41}
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().

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 43 of file Gelu.cpp.

44{
45 switch (input()->element_type())
46 {
47 case DataType::FLOAT32:
48 evalFloat();
49 break;
50 default:
51 throw std::runtime_error("luci-intp Gelu Unsupported type.");
52 }
53}

References input().

◆ input()

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

Definition at line 33 of file Gelu.h.

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

References luci_interpreter::Kernel::_inputs.

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

◆ output()

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

Definition at line 34 of file Gelu.h.

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

References luci_interpreter::Kernel::_outputs.

Referenced by configure().


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