Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RModel_Base.hxx
Go to the documentation of this file.
1#ifndef TMVA_SOFIE_RMODEL_BASE
2#define TMVA_SOFIE_RMODEL_BASE
3
4#include <type_traits>
5#include <unordered_set>
6#include <vector>
7#include <unordered_map>
8#include <memory>
9#include <ctime>
10#include <set>
11#include <iomanip>
12#include <fstream>
13#include <sstream>
14#include "TMVA/SOFIE_common.hxx"
15#include "TMVA/ROperator.hxx"
16#include "TBuffer.h"
17
18namespace TMVA {
19namespace Experimental {
20namespace SOFIE {
21
22enum class Options {
23 kDefault = 0x0,
24 kNoSession = 0x1,
25 kNoWeightFile = 0x2,
27 kGNN = 0x8,
28 kGNNComponent = 0x10,
29};
30
32
33std::underlying_type_t<Options> operator|(Options opA, Options opB);
34std::underlying_type_t<Options> operator|(std::underlying_type_t<Options> opA, Options opB);
35
37
38protected:
39 std::string fFileName; // file name of original model file for identification
40 std::string fParseTime; // UTC date and time string at parsing
41
43
44 std::unordered_set<std::string> fNeededBlasRoutines;
45
46 const std::unordered_set<std::string> fAllowedStdLib = {"vector", "algorithm", "cmath"};
47 std::unordered_set<std::string> fNeededStdLib = {"vector"};
48 std::unordered_set<std::string> fCustomOpHeaders;
49
50 std::string fName = "UnnamedModel";
51 std::string fGC; // generated code
52 bool fUseWeightFile = true;
53 bool fUseSession = true;
54 bool fIsGNN = false;
55 bool fIsGNNComponent = false;
56
57public:
58 /**
59 Default constructor. Needed to allow serialization of ROOT objects. See
60 https://root.cern/manual/io_custom_classes/#restrictions-on-types-root-io-can-handle
61 */
62 RModel_Base() = default;
63
64 RModel_Base(std::string name, std::string parsedtime);
65
66 // For GNN Functions usage
67 RModel_Base(std::string function_name) : fName(function_name) {}
68
69 void AddBlasRoutines(std::vector<std::string> routines)
70 {
71 for (auto &routine : routines) {
72 fNeededBlasRoutines.insert(routine);
73 }
74 }
75 void AddNeededStdLib(std::string libname)
76 {
77 if (fAllowedStdLib.find(libname) != fAllowedStdLib.end()) {
78 fNeededStdLib.insert(libname);
79 }
80 }
82 {
84 }
85 void GenerateHeaderInfo(std::string &hgname);
86 void PrintGenerated() { std::cout << fGC; }
87
88 std::string ReturnGenerated() { return fGC; }
89 void OutputGenerated(std::string filename = "", bool append = false);
90 void SetFilename(std::string filename) { fName = filename; }
91 std::string GetFilename() { return fName; }
92 const std::string & GetName() const { return fName;}
93};
94
95enum class GraphType { INVALID = 0, GNN = 1, GraphIndependent = 2 };
96
97enum class FunctionType { UPDATE = 0, AGGREGATE = 1 };
98enum class FunctionTarget { INVALID = 0, NODES = 1, EDGES = 2, GLOBALS = 3 };
99enum class FunctionReducer { INVALID = 0, SUM = 1, MEAN = 2 };
101
103public:
104 /**
105 Default constructor. Needed to allow serialization of ROOT objects. See
106 https://root.cern/manual/io_custom_classes/#restrictions-on-types-root-io-can-handle
107 */
108 RModel_GNNBase() = default;
109 virtual void Generate() = 0;
110 virtual ~RModel_GNNBase() = default;
111};
112
113} // namespace SOFIE
114} // namespace Experimental
115} // namespace TMVA
116
117#endif // TMVA_SOFIE_RMODEL_BASE
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
char name[80]
Definition TGX11.cxx:110
void GenerateHeaderInfo(std::string &hgname)
RModel_Base()=default
Default constructor.
std::unordered_set< std::string > fNeededBlasRoutines
const std::unordered_set< std::string > fAllowedStdLib
RModel_Base(std::string function_name)
std::unordered_set< std::string > fCustomOpHeaders
void OutputGenerated(std::string filename="", bool append=false)
std::unordered_set< std::string > fNeededStdLib
const std::string & GetName() const
void AddBlasRoutines(std::vector< std::string > routines)
void AddNeededStdLib(std::string libname)
void AddNeededCustomHeader(std::string filename)
void SetFilename(std::string filename)
RModel_GNNBase()=default
Default constructor.
std::underlying_type_t< Options > operator|(Options opA, Options opB)
Definition RModel.cxx:16
create variable transformations