ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci_interpreter_pal::lstm_internal::LstmStepManager Class Reference

#include <PALUnidirectionalSequenceLSTMCommon.h>

Public Member Functions

 LstmStepManager ()=delete
 
 LstmStepManager (const LstmSizeInfo &size_info)
 
void updateTime ()
 
void updateBatch ()
 
void resetTime ()
 
luci_interpreter::RuntimeShape inputShape () const
 
luci_interpreter::RuntimeShape stateShape () const
 
int inputOffset () const
 
int outputOffset () const
 
int hiddenStateOffset () const
 
int cellStateOffset () const
 

Detailed Description

Definition at line 190 of file PALUnidirectionalSequenceLSTMCommon.h.

Constructor & Destructor Documentation

◆ LstmStepManager() [1/2]

luci_interpreter_pal::lstm_internal::LstmStepManager::LstmStepManager ( )
delete

◆ LstmStepManager() [2/2]

luci_interpreter_pal::lstm_internal::LstmStepManager::LstmStepManager ( const LstmSizeInfo size_info)
inlineexplicit

Definition at line 196 of file PALUnidirectionalSequenceLSTMCommon.h.

196: size_info_(size_info) {}

Member Function Documentation

◆ cellStateOffset()

int luci_interpreter_pal::lstm_internal::LstmStepManager::cellStateOffset ( ) const
inline

◆ hiddenStateOffset()

int luci_interpreter_pal::lstm_internal::LstmStepManager::hiddenStateOffset ( ) const
inline

◆ inputOffset()

int luci_interpreter_pal::lstm_internal::LstmStepManager::inputOffset ( ) const
inline

Definition at line 254 of file PALUnidirectionalSequenceLSTMCommon.h.

254{ return input_offset_; }

Referenced by luci_interpreter_pal::lstm_internal::calculateLstmGate().

◆ inputShape()

luci_interpreter::RuntimeShape luci_interpreter_pal::lstm_internal::LstmStepManager::inputShape ( ) const
inline

◆ outputOffset()

int luci_interpreter_pal::lstm_internal::LstmStepManager::outputOffset ( ) const
inline

Definition at line 256 of file PALUnidirectionalSequenceLSTMCommon.h.

256{ return output_offset_; }

Referenced by luci_interpreter_pal::lstm_internal::lstmStep().

◆ resetTime()

void luci_interpreter_pal::lstm_internal::LstmStepManager::resetTime ( )
inline

◆ stateShape()

luci_interpreter::RuntimeShape luci_interpreter_pal::lstm_internal::LstmStepManager::stateShape ( ) const
inline

◆ updateBatch()

void luci_interpreter_pal::lstm_internal::LstmStepManager::updateBatch ( )
inline

Definition at line 215 of file PALUnidirectionalSequenceLSTMCommon.h.

216 {
217 current_batch_ += 1;
218 // batch inference for time major: no action needed
219 if (size_info_.time_major)
220 {
221 return;
222 }
223 // otherwise: singe batch inference, go to the next batch
224 hidden_state_offset_ += size_info_.state_dimension;
225 cell_state_offset_ += size_info_.state_dimension;
226 }

References luci_interpreter_pal::lstm_internal::LstmSizeInfo::state_dimension, and luci_interpreter_pal::lstm_internal::LstmSizeInfo::time_major.

Referenced by luci_interpreter_pal::evalLSTM(), and luci_interpreter_pal::evalLSTM< int8_t, int8_t, int16_t, int32_t >().

◆ updateTime()

void luci_interpreter_pal::lstm_internal::LstmStepManager::updateTime ( )
inline

Definition at line 198 of file PALUnidirectionalSequenceLSTMCommon.h.

199 {
200 current_time_ += 1;
201 // default as one batch per inference
202 int input_step = size_info_.input_dimension;
203 int output_step = size_info_.state_dimension;
204 // time major: batch inference
205 if (size_info_.time_major)
206 {
207 input_step = input_step * size_info_.batch_size;
208 output_step = output_step * size_info_.batch_size;
209 }
210
211 input_offset_ += input_step;
212 output_offset_ += output_step;
213 }

References luci_interpreter_pal::lstm_internal::LstmSizeInfo::batch_size, luci_interpreter_pal::lstm_internal::LstmSizeInfo::input_dimension, luci_interpreter_pal::lstm_internal::LstmSizeInfo::state_dimension, and luci_interpreter_pal::lstm_internal::LstmSizeInfo::time_major.

Referenced by luci_interpreter_pal::evalLSTM(), and luci_interpreter_pal::evalLSTM< int8_t, int8_t, int16_t, int32_t >().


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