admin管理员组

文章数量:1336424

I want to add a pooling layer on my model. I want to preserve the num of node as I m doing node prediction without batching.

import torch
from torch_geometric.nn import global_add_pool
# Assume your input tensor is x with shape (num_nodes, num_node_features)
x = torch.randn(10, 10)  # Example tensor with (num_nodes, num_node_features) = (10, 10)
# Apply global_add_pool
x_pooled = global_add_pool(x, batch=None)

x_pooled (1,10) But I want a pooling method to give me (10,x)

本文标签: pytorchGraph Neural Network Pooling for keeping the same shape of node without batchingStack Overflow