15import graph_nets
as gn
20from graph_nets
import utils_tf
41 print(s,
"memory:",memoryUse,
"(MB)")
72 snt.nets.MLP([LATENT_SIZE]*NUM_LAYERS, activate_final=
True),
78 def __init__(self, name="MLPGraphIndependent"):
81 edge_model_fn =
lambda:
snt.nets.MLP([LATENT_SIZE]*NUM_LAYERS, activate_final=
True),
82 node_model_fn =
lambda:
snt.nets.MLP([LATENT_SIZE]*NUM_LAYERS, activate_final=
True),
83 global_model_fn =
lambda:
snt.nets.MLP([LATENT_SIZE]*NUM_LAYERS, activate_final=
True))
93 edge_model_fn=make_mlp_model,
94 node_model_fn=make_mlp_model,
95 global_model_fn=make_mlp_model)
104 name="EncodeProcessDecode"):
111 def __call__(self, input_op, num_processing_steps):
115 for _
in range(num_processing_steps):
117 latent = self.
_core(core_input)
127printMemory(
"before instantiating")
129printMemory(
"after instantiating")
146printMemory(
"before first eval")
148printMemory(
"after first eval")
187tree.Branch(
"node_data",
"std::vector<float>" , node_data)
188tree.Branch(
"edge_data",
"std::vector<float>" , edge_data)
189tree.Branch(
"global_data",
"std::vector<float>" , global_data)
190tree.Branch(
"receivers",
"std::vector<int>" , receivers)
191tree.Branch(
"senders",
"std::vector<int>" , senders)
194print(
"\n\nSaving data in a ROOT File:")
199for i
in range(0,numevts):
201 s_nodes = graphData[
'nodes'].size
202 s_edges = graphData[
'edges'].size
203 num_edges = graphData[
'edges'].shape[0]
215 if (i < 1
and verbose) :
216 print(
"Nodes - shape:",
int(
node_data.size()/node_size),node_size,
"data: ",node_data)
217 print(
"Edges - shape:",num_edges, edge_size,
"data: ", edge_data)
218 print(
"Globals : ",global_data)
219 print(
"Receivers : ",receivers)
220 print(
"Senders : ",senders)
231printMemory(
"before eval1")
233printMemory(
"after eval1")
237for tf_graph_data
in dataset:
238 output_gnn = ep_model(tf_graph_data, processing_steps)
242 outgnn[0] =
np.mean(output_nodes)
243 outgnn[1] =
np.mean(output_edges)
244 outgnn[2] =
np.mean(output_globals)
248 if (firstEvent
and verbose) :
249 print(
"Output of first event")
258print(
"time to evaluate events",end-start)
259printMemory(
"after eval Nevts")
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
__init__(self, name="EncodeProcessDecode")
__call__(self, input_op, num_processing_steps)
__init__(self, name="MLPGraphIndependent")
__init__(self, name="MLPGraphNetwork")
get_dynamic_graph_data_dict(NODE_FEATURE_SIZE=2, EDGE_FEATURE_SIZE=2, GLOBAL_FEATURE_SIZE=1)
get_fix_graph_data_dict(num_nodes, num_edges, NODE_FEATURE_SIZE=2, EDGE_FEATURE_SIZE=2, GLOBAL_FEATURE_SIZE=1)