7namespace Experimental {
16 fGC += (
"//Code generated automatically by TMVA for Inference of Model file [" +
fFileName +
"] at [" +
fParseTime.substr(0,
fParseTime.length()-1) +
"] \n");
20 return std::toupper(c);
27 for (
const char *
h : {
"cstdint",
"cstring",
"string",
"vector",
"map",
"memory",
"sstream",
"iostream",
"iomanip",
28 "limits",
"stdexcept",
"algorithm",
"cmath",
"cassert"}) {
32 fGC +=
"#include <" + i +
">\n";
35 fGC +=
"#include \"" + i +
"\"\n";
41 fGC +=
"#include <fstream>\n";
44 fGC +=
"#include \"TFile.h\"\n";
46 fGC +=
"\nnamespace TMVA_SOFIE_" +
fName +
"{\n";
48 fGC += (
"namespace BLAS{\n");
51 fGC += (
"\textern \"C\" void sgemm_(const char * transa, const char * transb, const int * m, const int * n, const int * k,\n"
52 "\t const float * alpha, const float * A, const int * lda, const float * B, const int * ldb,\n"
53 "\t const float * beta, float * C, const int * ldc);\n");
57 fGC += (
"\textern \"C\" void sgemv_(const char * trans, const int * m, const int * n, const float * alpha, const float * A,\n"
58 "\t const int * lda, const float * X, const int * incx, const float * beta, const float * Y, const int * incy);\n");
60 fGC += (
"\textern \"C\" void saxpy_(const int * n, const float * alpha, const float * x,\n"
61 "\t const int * incx, float * y, const int * incy);\n");
63 fGC += (
"\textern \"C\" void scopy_(const int *n, const float* x, const int *incx, float* y, const int* incy);\n");
80 auto pos =
fGC.find(marker);
81 if (pos != std::string::npos) {
92 auto pos =
fGC.rfind(
"#endif");
93 if (pos != std::string::npos) {
114 throw std::runtime_error(
"tmva-sofie failed to open file for output generated inference code");
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
const_iterator begin() const
const_iterator end() const
void GenerateHeaderInfo(std::string &hgname)
RModel_Base()=default
Default constructor.
static constexpr const char * kHelperIncludesMarker
std::set< std::string > fNeededHelperFunctions
void EmitHelperFunctionsCode()
std::unordered_set< std::string > fNeededBlasRoutines
static constexpr const char * kHelperFunctionsMarker
std::unordered_set< std::string > fCustomOpHeaders
void OutputGenerated(std::string filename="", bool append=false)
std::unordered_set< std::string > fNeededStdLib
WeightFileType fWeightFile
std::string Clean_name(std::string input_tensor_name)
HelperFunctionsCode GenerateHelperFunctionsCode(const std::set< std::string > &neededHelpers, const std::string &modelNamespace, bool sgemmAlreadyDeclared=false)
Return the standalone C++ source of the inference helper functions requested in neededHelpers (see RM...
create variable transformations
Source code of the inference helper functions to embed in generated code so that it is standalone and...
std::string definitions
function/type definitions to place inside the generated model namespace
std::string cladDefinitions
Clad custom-derivative definitions to place at file scope (outside the model namespace) so that Clad ...
std::string includes
#include directives to place in the header preamble