This macro provides a simple example for the parsing of ONNX files into RModel object and further generating the .hxx header files for inference.
void TMVA_SOFIE_ONNX(std::string inputFile = ""){
if (inputFile.empty() )
inputFile = std::string(
gROOT->GetTutorialsDir()) +
"/machine_learning/Linear_16.onnx";
std::cout<<"\n\n";
std::cout<<"\n\n";
std::cout<<"Shape of tensor \"16weight\": ";
for(auto& it:tensorShape){
std::cout<<it<<",";
}
std::cout<<"\n\nData type of tensor \"16weight\": ";
std::cout<<SOFIE::ConvertTypeToString(tensorType);
std::cout<<"\n\n";
}
RModel Parse(std::string filename, bool verbose=false)
const ETensorType & GetTensorType(std::string name)
void PrintIntermediateTensors()
bool CheckIfTensorAlreadyExist(std::string tensor_name)
void OutputGenerated(std::string filename="", bool append=false)
void PrintInitializedTensors()
const std::vector< size_t > & GetTensorShape(std::string name)
void Generate(std::underlying_type_t< Options > options, int batchSize=-1, long pos=0, bool verbose=false)
void PrintRequiredInputTensors()
- Author
- Sanjiban Sengupta
Definition in file TMVA_SOFIE_ONNX.C.