Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avg_pool_neighbor_x now returns only the pooled neighbors' feature vectors #2207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ldv1
Copy link
Contributor

@ldv1 ldv1 commented Mar 5, 2021

This is a small PR.

avg_pool_neighbor_x takes in data and modifies data.x; sometimes we only want to average pool the neighbors to get information as a patch, without overwriting data.x; so, now we can write either
data.x = avg_pool_neighbor_x(data.x, data.edge_index, data.num_nodes)
or
patch_x = avg_pool_neighbor_x(data.x, data.edge_index, data.num_nodes)

@rusty1s
Copy link
Member

rusty1s commented May 1, 2021

Thanks for the PR. I'm not a big fan of avg_pool_neighbor_x to be honest, and will probably remove it at some point in time.

The proposed implementation is already quite similar to a normal scatter call:

path_x = scatter(data.x, data.edge_index[0], dim_size=data.num_nodes, reduce='mean')

It's hard for me to think of a use-case where this might be useful.

@ldv1
Copy link
Contributor Author

ldv1 commented May 2, 2021

You can think of it as a "local average pooling" as opposed to "global average pooling". I concatenate this information to the feature vector. It basically characterizes how much a node stands out among its neighbors (the information of a second-order derivative as a matter of fact). That's useful.

@rusty1s
Copy link
Member

rusty1s commented May 3, 2021

Yes, I definitely agree that this is useful. It's just that this functionality is already equivalent to a normal scatter call.

@rusty1s
Copy link
Member

rusty1s commented May 3, 2021

On a side node. What about we integrate that functionality in a non-trainable MessagePassing module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants