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

#include <GRU.h>

Collaboration diagram for luci_interpreter::kernels::GRU:

Public Member Functions

 GRU (const Tensor *input, const Tensor *hidden_hidden, const Tensor *hidden_hidden_bias, const Tensor *hidden_input, const Tensor *hidden_input_bias, const Tensor *state, Tensor *output, const GRUParams &params)
 
const Tensorinput () const
 
const Tensorhidden_hidden () const
 
const Tensorhidden_hidden_bias () const
 
const Tensorhidden_input () const
 
const Tensorhidden_input_bias () const
 
const Tensorstate () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::KernelWithParams< GRUParams >
const GRUParamsparams () 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< GRUParams >
 KernelWithParams (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs, const GRUParams &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< GRUParams >
const GRUParams _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 GRU.h.

Constructor & Destructor Documentation

◆ GRU()

luci_interpreter::kernels::GRU::GRU ( const Tensor input,
const Tensor hidden_hidden,
const Tensor hidden_hidden_bias,
const Tensor hidden_input,
const Tensor hidden_input_bias,
const Tensor state,
Tensor output,
const GRUParams params 
)

Definition at line 28 of file GRU.cpp.

31 : KernelWithParams<GRUParams>(
33 params)
34{
35}
const Tensor * input() const
Definition GRU.h:35
const Tensor * hidden_input_bias() const
Definition GRU.h:39
const Tensor * hidden_input() const
Definition GRU.h:38
Tensor * output() const
Definition GRU.h:41
const Tensor * hidden_hidden_bias() const
Definition GRU.h:37
const Tensor * hidden_hidden() const
Definition GRU.h:36
const Tensor * state() const
Definition GRU.h:40

References hidden_hidden(), hidden_hidden_bias(), hidden_input(), hidden_input_bias(), input(), and state().

Member Function Documentation

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 37 of file GRU.cpp.

38{
39 auto hidden_hidden_shape = getTensorShape(hidden_hidden());
40 auto hidden_input_shape = getTensorShape(hidden_input());
41 LUCI_INTERPRETER_CHECK(hidden_hidden_shape.Dims(0) == hidden_input_shape.Dims(0));
42
43 output()->resize(state()->shape());
44
45 LUCI_INTERPRETER_CHECK(input()->element_type() == output()->element_type());
46}
void resize(const Shape &new_shape)
Definition Tensor.cpp:56
#define LUCI_INTERPRETER_CHECK(cond)
Definition Utils.h:36
tflite::RuntimeShape getTensorShape(const Tensor *tensor)
Definition Utils.h:194

References luci_interpreter::kernels::getTensorShape(), hidden_hidden(), hidden_input(), input(), LUCI_INTERPRETER_CHECK, output(), luci_interpreter::Tensor::resize(), and state().

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 48 of file GRU.cpp.

49{
50 switch (input()->element_type())
51 {
52 case DataType::FLOAT32:
53 evalFloat();
54 break;
55 default:
56 throw std::runtime_error("luci-GRU Unsupported data type.");
57 }
58}

References input().

◆ hidden_hidden()

const Tensor * luci_interpreter::kernels::GRU::hidden_hidden ( ) const
inline

Definition at line 36 of file GRU.h.

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

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and GRU().

◆ hidden_hidden_bias()

const Tensor * luci_interpreter::kernels::GRU::hidden_hidden_bias ( ) const
inline

Definition at line 37 of file GRU.h.

37{ return _inputs[2]; }

References luci_interpreter::Kernel::_inputs.

Referenced by GRU().

◆ hidden_input()

const Tensor * luci_interpreter::kernels::GRU::hidden_input ( ) const
inline

Definition at line 38 of file GRU.h.

38{ return _inputs[3]; }

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and GRU().

◆ hidden_input_bias()

const Tensor * luci_interpreter::kernels::GRU::hidden_input_bias ( ) const
inline

Definition at line 39 of file GRU.h.

39{ return _inputs[4]; }

References luci_interpreter::Kernel::_inputs.

Referenced by GRU().

◆ input()

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

Definition at line 35 of file GRU.h.

35{ return _inputs[0]; }

References luci_interpreter::Kernel::_inputs.

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

◆ output()

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

Definition at line 41 of file GRU.h.

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

References luci_interpreter::Kernel::_outputs.

Referenced by configure().

◆ state()

const Tensor * luci_interpreter::kernels::GRU::state ( ) const
inline

Definition at line 40 of file GRU.h.

40{ return _inputs[5]; }

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and GRU().


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