Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Experimental::SOFIE::ROperator_LSTM< T > Class Template Referencefinal

template<typename T>
class TMVA::Experimental::SOFIE::ROperator_LSTM< T >

Long Short-Term Memory operator.

Inference code generation for one-layer LSTM. Supports forward, reverse and bidirectional LSTM. See the ONNX documentation for details about the supported LSTM architectures.

Definition at line 23 of file ROperator_LSTM.hxx.

Public Member Functions

 ROperator_LSTM ()
 Default constructor of ROperator_LSTM.
 
 ROperator_LSTM (std::vector< float > activation_alpha, std::vector< float > activation_beta, std::vector< std::string > activations, float clip, std::string direction, size_t hidden_size, size_t input_forget, size_t layout, std::string nameX, std::string nameW, std::string nameR, std::string nameB, std::string nameSequence_lens, std::string nameInitial_h, std::string nameInitial_c, std::string nameP, std::string nameY, std::string nameY_h, std::string nameY_c)
 Constructor of ROperator_LSTM from the attributes.
 
std::string Generate (std::string OpName)
 Generate the inference code.
 
std::string GenerateSessionMembersCode (std::string opName)
 Generate the code for the Session internal data vectors.
 
void Initialize (RModel &model)
 Initialize the model.
 
std::vector< std::vector< size_t > > ShapeInference (std::vector< std::vector< size_t > > input)
 Infers the shape of the output tensors.
 
std::vector< ETensorTypeTypeInference (std::vector< ETensorType > input)
 Infers the type of the output tensors.
 
- Public Member Functions inherited from TMVA::Experimental::SOFIE::ROperator
virtual ~ROperator ()
 
virtual std::string GenerateInitCode ()
 
virtual std::string Header ()
 

Private Attributes

std::vector< float > fAttrActivationAlpha
 Sacling values used by some activation functions.
 
std::vector< float > fAttrActivationBeta
 Scaling values used by some activation functions.
 
std::vector< std::string > fAttrActivations
 Activation functions.
 
float fAttrClip
 Clip threshold.
 
std::string fAttrDirection
 Direction of processing.
 
size_t fAttrHiddenSize
 Number of the hidden layers.
 
size_t fAttrInputForget
 Forget gate.
 
size_t fAttrLayout
 Data layout.
 
std::string fNB
 Name of the bias.
 
std::string fNInitial_c
 Name of the initial value of the cell states.
 
std::string fNInitial_h
 Name of the initial value of the hidden states.
 
std::string fNP
 Name of peepholes.
 
std::string fNR
 Name of the recurrence.
 
std::string fNSequence_lens
 Name of length of the sequences.
 
std::string fNW
 Name of the weights.
 
std::string fNX
 Name of the input.
 
std::string fNY
 Name of the output.
 
std::string fNY_c
 Name of the last sequence of the cell states.
 
std::string fNY_h
 Name of the last sequence of the output.
 
std::vector< size_t > fShapeB
 Shape of the bias.
 
std::vector< size_t > fShapeInitial_c
 Shape of the initial value of the cell states.
 
std::vector< size_t > fShapeInitial_h
 Shape of the initial value of the hidden states.
 
std::vector< size_t > fShapeP
 Shape of the peepholes.
 
std::vector< size_t > fShapeR
 Shape of the recurrence.
 
std::vector< size_t > fShapeSequence_lens
 Shape of the length of the sequences.
 
std::vector< size_t > fShapeW
 Shape of the weights.
 
std::vector< size_t > fShapeX
 Shape of the input.
 
std::vector< size_t > fShapeY
 Shape of the output.
 
std::vector< size_t > fShapeY_c
 Shape of the last sequence of the cell states.
 
std::vector< size_t > fShapeY_h
 Shape of the last sequence of the output.
 
std::string fType
 Type of the tensors.
 

Additional Inherited Members

- Protected Attributes inherited from TMVA::Experimental::SOFIE::ROperator
bool fUseSession = false
 flag to identify if using the session class
 
const std::string SP = " "
 space used to correctly indent the generated C++ code
 

#include <TMVA/ROperator_LSTM.hxx>

Inheritance diagram for TMVA::Experimental::SOFIE::ROperator_LSTM< T >:
[legend]

Constructor & Destructor Documentation

◆ ROperator_LSTM() [1/2]

template<typename T >
TMVA::Experimental::SOFIE::ROperator_LSTM< T >::ROperator_LSTM ( )
inline

Default constructor of ROperator_LSTM.

Definition at line 62 of file ROperator_LSTM.hxx.

◆ ROperator_LSTM() [2/2]

template<typename T >
TMVA::Experimental::SOFIE::ROperator_LSTM< T >::ROperator_LSTM ( std::vector< float >  activation_alpha,
std::vector< float >  activation_beta,
std::vector< std::string >  activations,
float  clip,
std::string  direction,
size_t  hidden_size,
size_t  input_forget,
size_t  layout,
std::string  nameX,
std::string  nameW,
std::string  nameR,
std::string  nameB,
std::string  nameSequence_lens,
std::string  nameInitial_h,
std::string  nameInitial_c,
std::string  nameP,
std::string  nameY,
std::string  nameY_h,
std::string  nameY_c 
)
inline

Constructor of ROperator_LSTM from the attributes.

Parameters
activation_alphascaling values used by some activation functions
activation_betascaling values used by some activation functions
activationsactivation functions
clipclip threshold
directiondirection of processing of the sequneces
hidden_sizenumber of hidden layers
input_forgetforget gate
layoutdata layout
nameXname of the input tensor
nameWname of the weight tensor
nameRname of the recurrence tensor
nameBname of the bias tensor
nameSequence_lensname of the length of the sequences
nameInitial_hname of the initial value of the hidden states
nameInitial_cname of the initial value of the cell states
namePname of the peepholes tensor
nameYname of the output
nameY_hname of the last sequence of the output
nameY_cname of the last sequence of the cell states

Definition at line 86 of file ROperator_LSTM.hxx.

Member Function Documentation

◆ Generate()

template<typename T >
auto TMVA::Experimental::SOFIE::ROperator_LSTM< T >::Generate ( std::string  OpName)
virtual

Generate the inference code.

Parameters
OpNamename of the operator

Implements TMVA::Experimental::SOFIE::ROperator.

Definition at line 283 of file ROperator_LSTM.icc.

◆ GenerateSessionMembersCode()

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::GenerateSessionMembersCode ( std::string  opName)
virtual

Generate the code for the Session internal data vectors.

Parameters
OpNamename of the operator

Reimplemented from TMVA::Experimental::SOFIE::ROperator.

Definition at line 237 of file ROperator_LSTM.icc.

◆ Initialize()

template<typename T >
auto TMVA::Experimental::SOFIE::ROperator_LSTM< T >::Initialize ( RModel model)
virtual

Initialize the model.

Parameters
Modelmodel

Implements TMVA::Experimental::SOFIE::ROperator.

Definition at line 40 of file ROperator_LSTM.icc.

◆ ShapeInference()

template<typename T >
auto TMVA::Experimental::SOFIE::ROperator_LSTM< T >::ShapeInference ( std::vector< std::vector< size_t > >  input)
virtual

Infers the shape of the output tensors.

Parameters
inputshape of the input tensors

Implements TMVA::Experimental::SOFIE::ROperator.

Definition at line 16 of file ROperator_LSTM.icc.

◆ TypeInference()

template<typename T >
auto TMVA::Experimental::SOFIE::ROperator_LSTM< T >::TypeInference ( std::vector< ETensorType input)
virtual

Infers the type of the output tensors.

Parameters
inputtype of the input tensors

Implements TMVA::Experimental::SOFIE::ROperator.

Definition at line 9 of file ROperator_LSTM.icc.

Member Data Documentation

◆ fAttrActivationAlpha

template<typename T >
std::vector<float> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrActivationAlpha
private

Sacling values used by some activation functions.

Definition at line 25 of file ROperator_LSTM.hxx.

◆ fAttrActivationBeta

template<typename T >
std::vector<float> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrActivationBeta
private

Scaling values used by some activation functions.

Definition at line 26 of file ROperator_LSTM.hxx.

◆ fAttrActivations

template<typename T >
std::vector<std::string> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrActivations
private

Activation functions.

Definition at line 27 of file ROperator_LSTM.hxx.

◆ fAttrClip

template<typename T >
float TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrClip
private

Clip threshold.

Definition at line 28 of file ROperator_LSTM.hxx.

◆ fAttrDirection

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrDirection
private

Direction of processing.

Definition at line 29 of file ROperator_LSTM.hxx.

◆ fAttrHiddenSize

template<typename T >
size_t TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrHiddenSize
private

Number of the hidden layers.

Definition at line 30 of file ROperator_LSTM.hxx.

◆ fAttrInputForget

template<typename T >
size_t TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrInputForget
private

Forget gate.

Definition at line 31 of file ROperator_LSTM.hxx.

◆ fAttrLayout

template<typename T >
size_t TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fAttrLayout
private

Data layout.

Definition at line 32 of file ROperator_LSTM.hxx.

◆ fNB

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNB
private

Name of the bias.

Definition at line 37 of file ROperator_LSTM.hxx.

◆ fNInitial_c

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNInitial_c
private

Name of the initial value of the cell states.

Definition at line 40 of file ROperator_LSTM.hxx.

◆ fNInitial_h

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNInitial_h
private

Name of the initial value of the hidden states.

Definition at line 39 of file ROperator_LSTM.hxx.

◆ fNP

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNP
private

Name of peepholes.

Definition at line 41 of file ROperator_LSTM.hxx.

◆ fNR

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNR
private

Name of the recurrence.

Definition at line 36 of file ROperator_LSTM.hxx.

◆ fNSequence_lens

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNSequence_lens
private

Name of length of the sequences.

Definition at line 38 of file ROperator_LSTM.hxx.

◆ fNW

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNW
private

Name of the weights.

Definition at line 35 of file ROperator_LSTM.hxx.

◆ fNX

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNX
private

Name of the input.

Definition at line 34 of file ROperator_LSTM.hxx.

◆ fNY

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNY
private

Name of the output.

Definition at line 42 of file ROperator_LSTM.hxx.

◆ fNY_c

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNY_c
private

Name of the last sequence of the cell states.

Definition at line 44 of file ROperator_LSTM.hxx.

◆ fNY_h

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fNY_h
private

Name of the last sequence of the output.

Definition at line 43 of file ROperator_LSTM.hxx.

◆ fShapeB

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeB
private

Shape of the bias.

Definition at line 49 of file ROperator_LSTM.hxx.

◆ fShapeInitial_c

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeInitial_c
private

Shape of the initial value of the cell states.

Definition at line 52 of file ROperator_LSTM.hxx.

◆ fShapeInitial_h

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeInitial_h
private

Shape of the initial value of the hidden states.

Definition at line 51 of file ROperator_LSTM.hxx.

◆ fShapeP

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeP
private

Shape of the peepholes.

Definition at line 53 of file ROperator_LSTM.hxx.

◆ fShapeR

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeR
private

Shape of the recurrence.

Definition at line 48 of file ROperator_LSTM.hxx.

◆ fShapeSequence_lens

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeSequence_lens
private

Shape of the length of the sequences.

Definition at line 50 of file ROperator_LSTM.hxx.

◆ fShapeW

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeW
private

Shape of the weights.

Definition at line 47 of file ROperator_LSTM.hxx.

◆ fShapeX

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeX
private

Shape of the input.

Definition at line 46 of file ROperator_LSTM.hxx.

◆ fShapeY

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeY
private

Shape of the output.

Definition at line 54 of file ROperator_LSTM.hxx.

◆ fShapeY_c

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeY_c
private

Shape of the last sequence of the cell states.

Definition at line 56 of file ROperator_LSTM.hxx.

◆ fShapeY_h

template<typename T >
std::vector<size_t> TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fShapeY_h
private

Shape of the last sequence of the output.

Definition at line 55 of file ROperator_LSTM.hxx.

◆ fType

template<typename T >
std::string TMVA::Experimental::SOFIE::ROperator_LSTM< T >::fType
private

Type of the tensors.

Definition at line 58 of file ROperator_LSTM.hxx.

  • tmva/sofie/inc/TMVA/ROperator_LSTM.hxx
  • tmva/sofie/inc/TMVA/ROperator_LSTM.icc