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

GATConv ignores "edge_attr" without error message #9940

Open
FrancisOWO opened this issue Jan 14, 2025 · 0 comments
Open

GATConv ignores "edge_attr" without error message #9940

FrancisOWO opened this issue Jan 14, 2025 · 0 comments
Labels

Comments

@FrancisOWO
Copy link

🛠 Proposed Refactor

Description

The current version of GATConv and GATv2Conv handle the edge_attr parameter inconsistently in the edge_update function. When users forget to set edge_dim in the constructor but pass edge_attr in the forward function, GATv2Conv will raise an error, whereas GATConv will ignore edge_attr without informing the users, leading them to mistakenly believe that edge_attr has been used in the convolution.

I think it would be better to raise an error in this situation, and it is important to maintain consistency between GATConv and GATv2Conv in the handling of edge_attr.

For more details, please refer to Issue #810.

Reference

Originally posted by @FrancisOWO in #810 (comment)

image

Hi, I noticed that in the latest version (2.7.0) of the code, this assert statement has been removed from GATConv, but it remains in GATv2Conv, as shown in the figure below.

62352385dca7b7eda00cd2df569658d

However, removing the assert statement leads to an issue: if a user passes edge_attr without setting edge_dim, the current GATConv will ignore edge_attr without informing the user, leading them to mistakenly believe that edge_attr has been used in the convolution.

I was not aware of this issue while using GATConv either, until I encountered an AssertionError when using GATv2Conv. Therefore, I think it would be better to retain the assert statement, or alternatively, to raise an error with some explanatory message, such as: require edge_dim to be set in the constructor when edge_attr is used.

I checked the commit history and found that this issue was caused by Commit 025b1cb (GATConv: require edge_dim to be set).

Do you think it would be better to retain the assert statement or raise an error?
At the very least, GATConv and GATv2Conv should be consistent in this part of the code.

Suggest a potential alternative/fix

I think it is important to maintain consistency between GATConv and GATv2Conv in the handling of edge_attr. It would be better to retain the assert statement, or alternatively, to raise an error with some explanatory message, such as: require edge_dim to be set in the constructor when edge_attr is used.

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

No branches or pull requests

1 participant