Skip to content

Inaccurate GATv2Conv Documentation #175

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

Closed
Animiral opened this issue May 25, 2022 · 1 comment · Fixed by #176
Closed

Inaccurate GATv2Conv Documentation #175

Animiral opened this issue May 25, 2022 · 1 comment · Fixed by #176

Comments

@Animiral
Copy link
Contributor

The documentation on GATv2Conv says:

the attention coefficients $\alpha_{ij}$ are given by

$$\alpha_{ij} = \frac{1}{z_i} \exp(\mathbf{a}^T LeakyReLU([W_2 \mathbf{x}_i; W_1 \mathbf{x}_j]))$$

This is not exactly the same as the Equation (7) from “How Attentive are Graph Attention Networks?”:

$$e(\mathbf{h}_i, \mathbf{h}_j) = \mathbf{a}^T LeakyReLU(\mathbf{W} \cdot [\mathbf{h}_i || \mathbf{h}_j])$$

I also checked the relevant piece of code (conv.jl):

    function message(Wix, Wjx, e)
        Wx = Wix + Wjx
        # [...]
        eij = sum(l.a .* leakyrelu.(Wx, l.negative_slope), dims=1)   # 1 × heads × nedges
        α = exp.(eij)
        return (α = α, β = α .* Wjx)
    end

Thanks to my project supervisor, I now realize that this is all correct and equivalent to the paper definition.
So it appears that the issue lies with the documentation.
Instead of a vector concatenation, it should state addition, or stick with the original order of operations.

As a small side note, the markup on GATConv is a bit broken, and it says “Dafault” instead of “Default”.

@CarloLucibello
Copy link
Member

Thanks to my project supervisor, I now realize that this is all correct and equivalent to the paper definition.

thanks for checking this out, the equivalence is not immediately obvious, maybe we should add a comment about that in the code

So it appears that the issue lies with the documentation. Instead of a vector concatenation, it should state addition, or stick with the original order of operations.

I agree, it should state addition. I'll leave you the honor of filing a PR if you have time, otherwise I'll see to it soon.

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 a pull request may close this issue.

2 participants