Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Experimental::RSofieReader Class Reference

TMVA::RSofieReader class for reading external Machine Learning models in ONNX files, Keras .h5 files or PyTorch .pt files and performing the inference using SOFIE It is reccomended to use ONNX if possible since there is a larger support for model operators.

Definition at line 45 of file RSofieReader.hxx.

Public Member Functions

 RSofieReader (const std::string &path, std::vector< std::vector< size_t > > inputShapes={}, int verbose=0)
 Create TMVA model from ONNX file print level can be 0 (minimal) 1 with info , 2 with all ONNX parsing info.
 
std::vector< float > Compute (const std::vector< float > &x)
 Compute model prediction on vector.
 
RTensor< float > Compute (RTensor< float > &x)
 Compute model prediction on input RTensor The shape of the input tensor should be {nevents, nfeatures} and the return shape will be {nevents, noutputs}.
 

Private Attributes

std::function< std::vector< float >(void *, const float *)> fFuncPtr
 
bool fInitialized = false
 
void * fSessionPtr = nullptr
 

#include <TMVA/RSofieReader.hxx>

Constructor & Destructor Documentation

◆ RSofieReader()

TMVA::Experimental::RSofieReader::RSofieReader ( const std::string &  path,
std::vector< std::vector< size_t > >  inputShapes = {},
int  verbose = 0 
)
inline

Create TMVA model from ONNX file print level can be 0 (minimal) 1 with info , 2 with all ONNX parsing info.

Definition at line 51 of file RSofieReader.hxx.

Member Function Documentation

◆ Compute() [1/2]

std::vector< float > TMVA::Experimental::RSofieReader::Compute ( const std::vector< float > &  x)
inline

Compute model prediction on vector.

Definition at line 220 of file RSofieReader.hxx.

◆ Compute() [2/2]

RTensor< float > TMVA::Experimental::RSofieReader::Compute ( RTensor< float > &  x)
inline

Compute model prediction on input RTensor The shape of the input tensor should be {nevents, nfeatures} and the return shape will be {nevents, noutputs}.

Definition at line 237 of file RSofieReader.hxx.

Member Data Documentation

◆ fFuncPtr

std::function<std::vector<float>(void *, const float *)> TMVA::Experimental::RSofieReader::fFuncPtr
private

Definition at line 261 of file RSofieReader.hxx.

◆ fInitialized

bool TMVA::Experimental::RSofieReader::fInitialized = false
private

Definition at line 259 of file RSofieReader.hxx.

◆ fSessionPtr

void* TMVA::Experimental::RSofieReader::fSessionPtr = nullptr
private

Definition at line 260 of file RSofieReader.hxx.

Libraries for TMVA::Experimental::RSofieReader:

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