Skip to content

Potential bug in the CoMPT attention implementation #3

Description

@qiyan98

Hi,

Thanks for open sourcing your wonderful work, "Learning Attributed Graph Representations with Communicative Message Passing Transformer." I found a potential bug in your in_scores cross-attention computation. It seems problematic when the edge feature matrix is not symmetric.

Please see my reproduction at:
https://colab.research.google.com/drive/1LLMc9Ue47MoHrTDqJgM-rMMLUacgXM_R?usp=sharing

And by einsum definition, the Eq. (8) and your code seem inconsistent. I could understand the Eq. (8), where the broadcast of node/token embedding for M_i is along the column axis. But your code implementation is not the same as such.

out_scores = torch.einsum('b h m d, b h m n d -> b h m n', query, key) / math.sqrt(d)
in_scores = torch.einsum('b h m d, b h m n d -> b h n m', query, key) / math.sqrt(d)

image

Any help is appreciated.

Many thank,
Qi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions