Open kar655 opened 1 month ago
Yes, this is an expected hack due to TorchScript. We cannot yet change the return type based on values of boolean types, so we opted to condition the return type based on return_attention_weights is None
vs return_attention_weights is bool
.
🐛 Describe the bug
When setting optional argument
return_attention_weights
in GATv2Conv's forward toFalse
it returns the attention weights. I believe it doesn't check parameter's value only if it not None.My guess is to change
return_attention_weights: Optional[bool] = None
to justreturn_attention_weights: bool = False
and appropriate if.By running
rg "isinstance(.*, bool)" -C 5
in repo other files might have similar issue:Let me know if it's a bug, or I don't get something. Thanks
Versions
I'm using
torch-geometric 2.4.0
but in the newest repo it still occurs.