-
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
Pytorch Sparse tensor support: AntiSymmetricConv
, CGConv
, and TransformerConv
#6633
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6633 +/- ##
==========================================
- Coverage 89.33% 87.73% -1.61%
==========================================
Files 422 422
Lines 22926 22887 -39
==========================================
- Hits 20482 20080 -402
- Misses 2444 2807 +363
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
out['edge_attr'] = None if values.dim() == 1 else values | ||
if out.get('edge_type', None) is None: | ||
out['edge_type'] = values | ||
out['edge_type'] = None if values.dim() == 1 else values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain? Not sure I understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike torch_sparse.SparseTensor
, edge_attr
will never be None
for PyTorch SparseTensor, which is not applicable for layers that accept edge_attr
, e.g. TransformerConv
pytorch_geometric/torch_geometric/nn/conv/transformer_conv.py
Lines 220 to 221 in a5e5a48
if edge_attr is not None: | |
out = out + edge_attr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. This is tricky. I reverted the edge_type
chance back since the values are always expected to be one-dimensional, but otherwise, I think the fix looks good to me.
A minor change on
nn.MessagePassing
layer, whereedge_attr
andedge_type
areNone
by default if the sparse adjacency matrix is 2-dimensional.