8namespace Experimental {
19 fName = std::move(other.fName);
32 fName = std::move(other.fName);
53 std::time_t ttime = std::time(0);
54 std::tm* gmt_time = std::gmtime(&ttime);
69 fGC+=
"\n\nnamespace Edge_Update{\nstruct Session {\n";
70 std::vector<std::vector<std::size_t>> Update_Input = {{block_size,
num_edge_features}};
83 fGC+=
"\n\nnamespace Node_Update{\nstruct Session {\n";
100 fGC+=
"\n\nnamespace Global_Update{\nstruct Session {\n";
118 fGC +=
"struct Session {\n";
119 fGC +=
"\n// Instantiating session objects for graph components\n";
120 fGC +=
"Edge_Update::Session edge_update;\n";
121 fGC +=
"Node_Update::Session node_update;\n";
122 fGC +=
"Global_Update::Session global_update;\n\n";
126 fGC +=
"\nstd::vector<float> fNodeUpdates = std::vector<float>(" + std::to_string(
num_nodes) +
"*" + std::to_string(
num_node_features) +
");\n";
128 fGC +=
"\n// input vectors for edge update\n";
129 fGC +=
"std::vector<float> fEdgeInputs = std::vector<float>(" + std::to_string(
num_edges) +
"*" + std::to_string(num_edge_features_input) +
");\n";
131 fGC +=
"\n// input vectors for node update\n";
132 fGC +=
"std::vector<float> fNodeInputs = std::vector<float>(" + std::to_string(
num_nodes) +
"*" + std::to_string(num_node_features_input) +
");\n";
134 fGC +=
"\nvoid infer(TMVA::Experimental::SOFIE::GNN_Data& input_graph){\n";
137 fGC +=
"\n// --- Edge Update ---\n";
139 std::string e_size_input = std::to_string(num_edge_features_input);
140 fGC +=
"for (int k = 0; k < " + std::to_string(
num_edges) +
"; k++) { \n";
141 fGC +=
" std::copy(input_graph.edge_data.GetData() + k * " + e_size_input +
142 ", input_graph.edge_data.GetData() + (k + 1) * " + e_size_input +
143 ", fEdgeInputs.begin() + k * " + e_size_input +
");\n";
149 fGC +=
"\n// resize edge graph data since output feature size is not equal to input size\n";
153 fGC +=
"\nfor (int k = 0; k < " + std::to_string(
num_edges) +
"; k++) { \n";
155 ",input_graph.edge_data.GetData() + k * " + std::to_string(
num_edge_features)+
");\n";
160 std::string n_size_input = std::to_string(num_node_features_input);
161 fGC +=
"\n// --- Node Update ---";
162 fGC +=
"\nfor (int k = 0; k < " + std::to_string(
num_nodes) +
"; k++) { \n";
163 fGC +=
" std::copy(input_graph.node_data.GetData() + k * " + n_size_input +
164 ", input_graph.node_data.GetData() + (k + 1) * " + n_size_input +
165 ", fNodeInputs.begin() + k * " + n_size_input +
");\n";
168 fGC+=
"\nfNodeUpdates = ";
173 fGC +=
"\n// resize node graph data since output feature size is not equal to input size\n";
177 fGC +=
"\nfor (int k = 0; k < " + std::to_string(
num_nodes) +
"; k++) { \n";
179 ",input_graph.node_data.GetData() + k * " + std::to_string(
num_node_features)+
");\n";
184 fGC +=
"\n// --- Global Update ---\n";
185 fGC +=
"std::vector<float> Global_Data = ";
190 fGC +=
"\n// resize global graph data since output feature size is not equal to input size\n";
191 fGC+=
"input_graph.global_data = input_graph.global_data.Resize({"+std::to_string(
num_global_features)+
"});\n";
194 fGC +=
"\nstd::copy(Global_Data.begin(), Global_Data.end(), input_graph.global_data.GetData());";
197 fGC += (
"}\n};\n} //TMVA_SOFIE_" +
fName +
"\n");
198 fGC +=
"\n#endif // TMVA_SOFIE_" + hgname +
"\n";
void GenerateHeaderInfo(std::string &hgname)
std::size_t num_global_features
RModel_GraphIndependent & operator=(RModel_GraphIndependent &&other)
std::size_t num_node_features
std::unique_ptr< RFunction_Update > edges_update_block
RModel_GraphIndependent()
std::size_t num_edge_features
std::unique_ptr< RFunction_Update > globals_update_block
std::unique_ptr< RFunction_Update > nodes_update_block
create variable transformations
std::vector< std::pair< int, int > > edges
std::unique_ptr< RFunction_Update > nodes_update_block
std::unique_ptr< RFunction_Update > globals_update_block
std::unique_ptr< RFunction_Update > edges_update_block