Heterogeneous Graph Classification with empty node types #4281
-
Hi, All the edges are directed since the node features happen at different times. `from torch_geometric.nn import HeteroConv, GraphConv,GATv2Conv
modelo=HeteroGNN(data.metadata(),10,5,2,5).to("cuda:0")` I applied this model to a single graph and obtained the following:
How can I aggregate information about the present nodes, ignoring the empty nodes, in order to make a graph classification? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
i guess i will add a virtual node as solution for now. Any other solution pls write |
Beta Was this translation helpful? Give feedback.
-
Any reason you want to maintain at all? Is this for batching reasons only? Your output looks correct to me. You now only need to aggregate the information from node types that are present: out = 0
for node_type in x_dict.keys():
if x_dict[node_type].numel() == 0:
continue
out += global_mean_pool(x_dict[node_type], batch_dict[node_type]) Let me know if this works for you! |
Beta Was this translation helpful? Give feedback.
Any reason you want to maintain at all? Is this for batching reasons only?
Your output looks correct to me. You now only need to aggregate the information from node types that are present:
Let me know if this works for you!