Heterogeneous graph and pooling #3462
-
Hi, I'm working on a heterogeneous graph like below: Unlike, the example on PyG document, this graph has the same node attributes, but different edge attributes. As in the figure, most of the nodes in A are connected to each other with edges with 4-d edge attributes After creating a graph with In this situation, the goal is to embed the entire graph into a vector. I've planed to design a GNN having some convolution type of layers and pooling between them. I am also confused about building a heterogeneous GNN model, but it will be figured out soon. But I cannot determine if it is possible to pool this type of heterogeneous graph or not. So, here is my question.
Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Pooling can be achieved by pooling each node type and combining their graph-level outputs afterwards, e.g.: loader = DataLoader(dataset, ...)
for data in loader:
x_dict = {key: global_mean_pool(data[key].x, data[key].batch) for key in data.node_types}
out = torch.stack(x_dict.values(), dim=0).sum(dim=0) |
Beta Was this translation helpful? Give feedback.
Pooling can be achieved by pooling each node type and combining their graph-level outputs afterwards, e.g.: