Hi, this tool is very powerful and amazing. Thanks a lot!
However, when I ran gcn.py from example for testing, an error occurred:
Traceback (most recent call last):
File "gcn.py", line 55, in
train()
File "gcn.py", line 39, in train
F.nll_loss(model()[data.train_mask], data.y[data.train_mask]).backward()
File "/Users/william/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(input, *kwargs)
File "gcn.py", line 25, in forward
x = F.relu(self.conv1(x, edge_index))
File "/Users/william/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(input, *kwargs)
File "/Users/william/anaconda3/lib/python3.6/site-packages/torch_geometric/nn/conv/gcn_conv.py", line 100, in forward
self.improved, x.dtype)
File "/Users/william/anaconda3/lib/python3.6/site-packages/torch_geometric/nn/conv/gcn_conv.py", line 78, in norm
edge_index, edge_weight, fill_value, num_nodes)
File "/Users/william/anaconda3/lib/python3.6/site-packages/torch_geometric/utils/loop.py", line 107, in add_remaining_self_loops
inv_mask = 1 - mask
File "/Users/william/anaconda3/lib/python3.6/site-packages/torch/tensor.py", line 325, in __rsub__
return _C._VariableFunctions.rsub(self, other)
RuntimeError: Subtraction, the-operator, with a bool tensor is not supported. If you are trying to invert a mask, use the~orbitwise_not()operator instead.
It seems that bool tensor does not support the - operator yet. So I modified the line 107 in loop.py as:
inv_mask = ~mask # inv_mask = 1 - mask
and then re-run gcn.py. The result shows that it works!
...
Epoch: 200, Train: 1.0000, Val: 0.8080, Test: 0.8240
I met the same issue. It might be because of the new pytorch version
Thank you. This is already fixed in master, so installing from source should fix it. I will craft a new minor release soon.
Hey, @rusty1s thanks for this amazing library.
I met the same issue for Knn graph. I even installed the latest commit but the issue still persisted. Also, when I run tests, the issue repeats at multiple times for knn related functions.
Other than the above errors, I also see failures with the error "ValueError: multi_class should be either multinomial or ovr, got auto" in the file logistic.py and there is also assertion error in the file test_signed_gcn.py.
Please update torch-cluster to version 1.4.4. The SignedGCN bug should be fixed in PyG master by now.
Maybe I'm misunderstood, but doing pip install torch-cluster didn't fix the issue for me
Are you sure you have the latest version installed? You can check this via
import torch_cluster
print(torch_cluster.__version__)
And update via
pip install --upgrade torch-cluster
I ended up solving the problem the way the OP solved it. I may take a look at your solution later. Thanks for your contributions to the open source world, rusty1s!
Hello, I'm running the basic example of GCN under "Learning Methods on Graphs" in the introduction section: https://pytorch-geometric.readthedocs.io/en/latest/notes/introduction.html
And I'm having the same issue. Should I downgrade pytorch, as this was working before? I have version 1.4.4 of torch_cluster already. My versions of pytorch are:
>>> import torch ; print(torch.__version__)
1.2.0
>>> import torchvision ; print(torchvision.__version__)
0.4.0a0+6b959ee
>>> import torch_cluster ; print(torch_cluster.__version__)
1.4.4
import torch_geometric ; print(torch_geometric.__version__)
1.3.0
Any suggestions?
This is a bug introduced by PyTorch 1.2. You can install PyTorch Geometric from master to fix this (just clone the repository and run python setup.py install). I will craft a new release soon to fix this.
@rusty1s thanks for the update! I just wanted to add that now, when you execute the example I mentioned, we receive a warning:
UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
According to pytorch/pytorch#24918, in the future this will raise an error, so might be worth it to update the example.
Thanks for such awesome tool!
Thank you for the reminder, will work on it.