This macro provides a simple example for the parsing of ONNX files into RModel object and further generating the .hxx header files for inference.
inputFile = std::string(
gROOT->GetTutorialsDir()) +
"/machine_learning/Linear_16.onnx";
model.Generate();
model.OutputGenerated();
model.PrintRequiredInputTensors();
std::cout<<"\n\n";
model.PrintInitializedTensors();
std::cout<<"\n\n";
model.PrintIntermediateTensors();
std::cout<<"\n\nTensor \"16weight\" already exist: "<<std::boolalpha<<model.CheckIfTensorAlreadyExist("16weight")<<"\n\n";
std::vector<size_t>
tensorShape = model.GetTensorShape(
"16weight");
std::cout<<"Shape of tensor \"16weight\": ";
std::cout<<it<<",";
}
std::cout<<"\n\nData type of tensor \"16weight\": ";
std::cout<<SOFIE::ConvertTypeToString(
tensorType);
std::cout<<"\n\n";
model.PrintGenerated();
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
- Author
- Sanjiban Sengupta
Definition in file TMVA_SOFIE_ONNX.C.