TMVA::RSofieReader class for reading external Machine Learning models in ONNX files, Keras .h5 or .keras 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.
Classes | |
| struct | CustomOperatorData |
Public Member Functions | |
| RSofieReader () | |
| Dummy constructor which needs model loading afterwards. | |
| 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. | |
| void | AddCustomOperator (const std::string &opName, const std::string &inputNames, const std::string &outputNames, const std::string &outputShapes, const std::string &fileName) |
| std::vector< float > | Compute (const std::vector< float > &x) |
| 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} support for now only a single input. | |
| template<typename... T> | |
| std::vector< float > | Compute (T... x) |
| Compute model prediction on vector. | |
| std::vector< float > | DoCompute (const std::vector< float > &x1) |
| std::vector< float > | DoCompute (const std::vector< float > &x1, const std::vector< float > &x2) |
| std::vector< float > | DoCompute (const std::vector< float > &x1, const std::vector< float > &x2, const std::vector< float > &x3) |
| void | Load (const std::string &path, std::vector< std::vector< size_t > > inputShapes={}, int verbose=0) |
Private Attributes | |
| std::vector< CustomOperatorData > | fCustomOperators |
| void * | fFuncPtr = nullptr |
| bool | fInitialized = false |
| int | fNInputs = 0 |
| void * | fSessionPtr = nullptr |
#include <TMVA/RSofieReader.hxx>
|
inline |
Dummy constructor which needs model loading afterwards.
Definition at line 50 of file RSofieReader.hxx.
|
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 53 of file RSofieReader.hxx.
|
inline |
Definition at line 304 of file RSofieReader.hxx.
|
inline |
Definition at line 351 of file RSofieReader.hxx.
Compute model prediction on input RTensor The shape of the input tensor should be {nevents, nfeatures} and the return shape will be {nevents, noutputs} support for now only a single input.
Definition at line 366 of file RSofieReader.hxx.
|
inline |
Compute model prediction on vector.
Definition at line 338 of file RSofieReader.hxx.
|
inline |
Definition at line 311 of file RSofieReader.hxx.
|
inline |
Definition at line 319 of file RSofieReader.hxx.
|
inline |
Definition at line 327 of file RSofieReader.hxx.
|
inline |
Definition at line 58 of file RSofieReader.hxx.
|
private |
Definition at line 402 of file RSofieReader.hxx.
|
private |
Definition at line 392 of file RSofieReader.hxx.
Definition at line 389 of file RSofieReader.hxx.
|
private |
Definition at line 390 of file RSofieReader.hxx.
|
private |
Definition at line 391 of file RSofieReader.hxx.