1#ifndef TMVA_SOFIE_ROPERATOR_GRU
2#define TMVA_SOFIE_ROPERATOR_GRU
15namespace Experimental {
79 std::vector<float> activation_beta,
80 std::vector<std::string> activations,
float clip,
81 std::string direction,
size_t hidden_size,
82 size_t layout,
size_t linear_before_reset,
83 std::string nameX, std::string nameW, std::string nameR,
84 std::string nameB, std::string nameSequence_lens,
85 std::string nameInitial_h, std::string nameY, std::string nameY_h)
90 fNX(UTILITY::Clean_name(nameX)),
fNW(UTILITY::Clean_name(nameW)),
91 fNR(UTILITY::Clean_name(nameR)),
fNB(UTILITY::Clean_name(nameB)),
94 fNY(UTILITY::Clean_name(nameY)),
fNY_h(UTILITY::Clean_name(nameY_h)) {
95 if (std::is_same<T, float>::value) {
98 throw std::runtime_error(
99 "TMVA SOFIE Encountered unsupported type parsing a GRU operator");
107 std::vector<ETensorType>
TypeInference(std::vector<ETensorType> );
113 std::vector<std::vector<size_t>>
ShapeInference(std::vector<std::vector<size_t>> );
135 std::vector<std::string>
GetBlasRoutines() {
return { std::string(
"Gemm"), std::string(
"Axpy") }; }
Gated Recurrent Unit operator.
std::string GenerateSessionMembersCode(std::string opName)
Generate the code for the Session internal data vectors.
std::vector< size_t > fShapeY
Shape of the output.
std::string fNX
Name of the input.
std::string fType
Type of the tensors.
size_t fAttrLayout
Data layout.
std::string fAttrDirection
Direction of processing.
std::string fNR
Name of the recurrence.
float fAttrClip
Clip threshold.
std::vector< float > fAttrActivationBeta
Scaling values used by some activation functions.
std::vector< std::string > GetBlasRoutines()
Returns the blas routines needed to compile the generated code.
std::string fNY
Name of the output.
std::string fNY_h
Name of the last sequence of the output.
std::string fNSequence_lens
Name of the length of the sequences.
std::string fNB
Name of the bias.
std::vector< std::string > fAttrActivations
Activation functions.
ROperator_GRU(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 layout, size_t linear_before_reset, std::string nameX, std::string nameW, std::string nameR, std::string nameB, std::string nameSequence_lens, std::string nameInitial_h, std::string nameY, std::string nameY_h)
Constructor of ROperator_GRU from the attributes.
size_t fAttrHiddenSize
Number of the hidden layers.
std::vector< std::vector< size_t > > ShapeInference(std::vector< std::vector< size_t > >)
Infers the shape of the output tensors.
std::vector< float > fAttrActivationAlpha
Scaling values used by some activation functions.
std::vector< size_t > fShapeR
Shape of the recurrence.
void Initialize(RModel &)
Initialize the model.
std::string fNW
Name of the weights.
std::vector< size_t > fShapeX
Shape of the input.
std::string Generate(std::string)
Generate the inference code.
std::vector< size_t > fShapeInitial_h
Shape of the initial value of hidden states.
std::vector< size_t > fShapeSequence_lens
Shape of the length of the sequences.
std::vector< size_t > fShapeY_h
Shape of the last sequence of the output.
size_t fAttrLinearBeforeReset
Linear layer before the reset gate.
std::vector< size_t > fShapeB
Shape of the bias.
std::vector< ETensorType > TypeInference(std::vector< ETensorType >)
Infers the type of the output tensors.
std::string fNInitial_h
Name of the initial value of the hidden states.
std::vector< size_t > fShapeW
Shape of the weights.
ROperator_GRU()
Default constructor of ROperator_GRU.
create variable transformations