-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
GAT model - last layer incorrect? #4298
Comments
That is interesting, I think you are right that we need to fix the |
I think something like this would work:
So we always make sure that the last If this seems correct, I can make a PR. |
Yeah, that is correct. I was too fast and went ahead and already fixed it, see #4299. I'm sorry :( |
Sure, thanks for fixing this! |
🐛 Describe the bug
In GAT paper last layer averages attention heads instead of concatenation, which corresponds to
concat=False
inGATConv
in PyTorchGeometric. This is also the case in all examples.However, in
GAT
model the last layer is still concatenated, as only the convolution is passed toBasicGNN
. This means that usingGAT
, we actually concatenate the attention heads in the last layer, which is incorrect, or at least an unexpected behavior.If I'm correct, I see two ways of fixing this:
(num_nodes, K * out_channels)
(forK
attention heads) to(num_nodes, out_channels)
, where attention heads are averaged.forward()
method inGAT
and addconcat_last_layer=False
option:True
, run as-isFalse
, override the.forward()
method, use the parent's.forward()
up toN-1
layer, and run the last layer separately, using concat=False`Environment
conda
,pip
, source):pip
torch-scatter
):The text was updated successfully, but these errors were encountered: