16#include "output_transform.hxx"
34 printf(
" Rmem = %8.3f MB, Vmem = %8.f3 MB \n",
35 p.fMemResident /1024.,
38 return p.fMemResident / 1024.;
44 std::cout <<
" shape : " <<
ConvertShapeToString(t.GetShape()) <<
" size : " << t.GetSize() <<
"\n";
45 auto & shape = t.GetShape();
47 size_t nrows = (shape.size() > 1) ? shape[0] : 1;
48 size_t ncols = (shape.size() > 1) ? t.GetStrides()[0] : shape[0];
49 for (
size_t i = 0; i <
nrows; i++) {
52 if (
j>10) std::cout <<
"... ";
53 std::cout << *
p << std::endl;
56 std::cout << *
p <<
", ";
60 std::cout << std::endl;
63 if (!
txt.empty()) std::cout << std::endl <<
txt << std::endl;
73 TMVA_SOFIE_core::Session
core;
86 for (
int i = 0; i <
nsteps; i++) {
114 std::vector<GNN_Data> dataSet;
115 dataSet.reserve(
nevts);
116 for (
int i = 0; i <
nevts; i++) {
128 auto genValue = [&]() {
return r.Rndm()*10 -5; };
129 auto genLink = [&] () {
return r.Integer(num_nodes);};
134 dataSet.emplace_back(
gd);
140 bool verbose =
false;
148 std::vector<GNN_Data> dataSet;
149 dataSet.reserve(
nevts);
150 for (
int i = 0; i <
nevts; i++) {
152 auto &
n = (*(
ndata.GetPtr()))[i];
154 auto &
e = (*(
edata.GetPtr()))[i];
156 auto &
g = (*(
gdata.GetPtr()))[i];
161 auto &
r = (*(
rdata.GetPtr()))[i];
162 auto & s = (*(
sdata.GetPtr()))[i];
164 std::copy(
r.begin(),
r.end(),
gd.edge_index.GetData());
165 std::copy(s.begin(), s.end(),
gd.edge_index.GetData()+num_edges);
167 dataSet.emplace_back(
Copy(
gd));
168 if (i < 1 && verbose)
Print(dataSet[i],
"Input for Event" + std::to_string(i));
181 const int seed = 111;
190 std::cout <<
"reading data\n";
197 auto h1 =
new TH1D(
"h1",
"SOFIE Node data",40,1,0);
198 auto h2 =
new TH1D(
"h2",
"SOFIE Edge data",40,1,0);
199 auto h3 =
new TH1D(
"h3",
"SOFIE Global data",40,1,0);
200 std::cout <<
"doing inference...\n";
205 for (
int i = 0; i <
nevts; i++) {
209 if (i < 1 && verbose)
Print(
lr,
"Output for Event" + std::to_string(i));
217 auto c1 =
new TCanvas(
"c1",
"SOFIE Results");
220 c1->cd(2); h2->Draw();
221 c1->cd(3); h3->Draw();
225 auto c2 =
new TCanvas(
"c2",
"Reference Results");
227 auto o1 = file->Get(
"h1");
228 auto o2 = file->Get(
"h2");
229 auto o3 = file->Get(
"h3");
231 c2->cd(1);
o1->Draw();
232 c2->cd(2);
o2->Draw();
233 c2->cd(3);
o3->Draw();
#define R__ADD_INCLUDE_PATH(PATH)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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
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 r
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 result
void Print(GNN_Data &d, std::string txt="")
const int EDGE_FEATURE_SIZE
const int GLOBAL_FEATURE_SIZE
std::vector< GNN_Data > ReadData(std::string treename, std::string filename)
void PrintTensor(RTensor< T > &t)
void TMVA_SOFIE_GNN_Application(bool verbose=false)
const int NODE_FEATURE_SIZE
double check_mem(std::string s="")
std::vector< GNN_Data > GenerateData(int nevts, int seed)
R__EXTERN TSystem * gSystem
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
const_iterator begin() const
const_iterator end() const
A "std::vector"-like collection of values implementing handy operation to analyse them.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a double per channel (see TH1 documentation)
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
Random number generator class based on M.
virtual int GetProcInfo(ProcInfo_t *info) const
Returns cpu and memory used by this process into the ProcInfo_t structure.
TMVA::Experimental::RTensor< T > Concatenate(TMVA::Experimental::RTensor< T > &t1, TMVA::Experimental::RTensor< T > &t2, int axis=0)
std::string ConvertShapeToString(const std::vector< size_t > &shape)
GNN_Data Copy(const GNN_Data &data)
Double_t Mean(Long64_t n, const T *a, const Double_t *w=nullptr)
Returns the weighted mean of an array a with length n.
TMVA_SOFIE_core::Session core
TMVA_SOFIE_output_transform::Session output_transform
TMVA_SOFIE_decoder::Session decoder
TMVA_SOFIE_encoder::Session encoder
std::vector< GNN_Data > Infer(const GNN_Data &data, int nsteps)