Exemplo n.º 1
0
 def __init__(self, layers=args.layer, name="gcn"):
     super(GCN, self).__init__(name=name)
     with self._enter_variable_scope():
         self._networks = []
         if layers == 1:
             self._networks.append(
                 GraphIndependent(
                     node_model_fn=dropout_fn))
             self._networks.append(
                 EdgeBlock(
                     edge_model_fn=edge_model_fn,
                     use_edges=False,
                     use_receiver_nodes=True,
                     use_sender_nodes=False,
                     use_globals=False))
             self._networks.append(
                 NodeBlock(
                     node_model_fn=make_linear_model,
                     use_received_edges=True,
                     use_sent_edges=False,
                     use_nodes=False,
                     use_globals=False))
         else:
             for layer in range(args.layer - 1):
                 self._networks.append(
                     GraphIndependent(
                         node_model_fn=dropout_fn))
                 self._networks.append(
                     EdgeBlock(
                         edge_model_fn=edge_model_fn,
                         use_edges=False,
                         use_receiver_nodes=True,
                         use_sender_nodes=False,
                         use_globals=False))
                 self._networks.append(
                     NodeBlock(
                         node_model_fn=make_linear_model,
                         use_received_edges=True,
                         use_sent_edges=False,
                         use_nodes=False,
                         use_globals=False))
             self._networks.append(
                 GraphIndependent(
                     node_model_fn=dropout_fn))
             self._networks.append(
                 EdgeBlock(
                     edge_model_fn=edge_model_fn,
                     use_edges=False,
                     use_receiver_nodes=True,
                     use_sender_nodes=False,
                     use_globals=False))
             self._networks.append(
                 NodeBlock(
                     node_model_fn=final_layer,
                     use_received_edges=True,
                     use_sent_edges=False,
                     use_nodes=False,
                     use_globals=False))
Exemplo n.º 2
0
 def __init__(self, name="MLPGraphIndependent"):
     super(MLPGraphIndependent, self).__init__(name=name)
     with self._enter_variable_scope():
         self._network = GraphIndependent(
             edge_model_fn=make_mlp_model,
             node_model_fn=make_mlp_model)
Exemplo n.º 3
0
 def _kg_encoder(self):
     return GraphIndependent(self._edge_model, self._node_model, name='kg_encoder')