7namespace Experimental {
16 fGC += (
"//Code generated automatically by TMVA for Inference of Model file [" +
fFileName +
"] at [" +
fParseTime.substr(0,
fParseTime.length()-1) +
"] \n");
19 std::transform(hgname.begin(), hgname.end(), hgname.begin(), [](
unsigned char c) {
20 return std::toupper(c);
22 hgname =
"ROOT_TMVA_SOFIE_" + hgname;
23 fGC +=
"\n#ifndef " + hgname +
"\n";
24 fGC +=
"#define " + hgname +
"\n\n";
26 fGC +=
"#include <" + i +
">\n";
29 fGC +=
"#include \"" + i +
"\"\n";
33 fGC +=
"#include \"TMVA/SOFIE_common.hxx\"\n";
35 fGC +=
"#include <fstream>\n";
38 fGC +=
"#include \"TFile.h\"\n";
40 fGC +=
"\nnamespace TMVA_SOFIE_" +
fName +
"{\n";
42 fGC += (
"namespace BLAS{\n");
44 if (routine ==
"Gemm") {
45 fGC += (
"\textern \"C\" void sgemm_(const char * transa, const char * transb, const int * m, const int * n, const int * k,\n"
46 "\t const float * alpha, const float * A, const int * lda, const float * B, const int * ldb,\n"
47 "\t const float * beta, float * C, const int * ldc);\n");
48 }
else if (routine ==
"Gemv") {
49 fGC += (
"\textern \"C\" void sgemv_(const char * trans, const int * m, const int * n, const float * alpha, const float * A,\n"
50 "\t const int * lda, const float * X, const int * incx, const float * beta, const float * Y, const int * incy);\n");
51 }
else if (routine ==
"Axpy") {
52 fGC += (
"\textern \"C\" void saxpy_(const int * n, const float * alpha, const float * x,\n"
53 "\t const int * incx, float * y, const int * incy);\n");
54 }
else if (routine ==
"Copy") {
55 fGC += (
"\textern \"C\" void scopy_(const int *n, const float* x, const int *incx, float* y, const int* incy);\n");
75 throw std::runtime_error(
"tmva-sofie failed to open file for output generated inference code");
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
void GenerateHeaderInfo(std::string &hgname)
RModel_Base()=default
Default constructor.
std::unordered_set< std::string > fNeededBlasRoutines
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)
create variable transformations