Can the message function take the node and all its neighbors as input? #2368
gebrahimi91
started this conversation in
General
Replies: 2 comments
-
I think you need to
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Currently, this is only possible via some hacks: def message_and_aggregate(self, adj_t, x):
col = adj_t.storage.col()
rowcount = adj_t.storage.rowcount()
x_j = x[col].split(rowcount.tolist())
x_neighbor = torch.nn.utils.rnn.pad_sequence(x_j, batch_first=True)
# x_neighbor will have shape [num_nodes, num_max_neighbors, num_features]
... # Do whatever you like to do with this |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am trying to use my own designed network to message and aggregate the messages. The way that i aggregate the inputs is not simple mean, sum, etc. so node i representation and all its neighbors are fed to a neural network together and the aggregation happens in the neural network and not after message from each neighbor is created. in other words, i need a message function like this:
def message(x_i):
return neural network([x_i, x_j for all neighbors of x_i])
after doing this the message is already passed and aggregated (i do not need any more aggregation and aggregation can be set to None).
Is there an easy way to do it using message function or message_and_update function?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions