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

Subtraction, the - operator, with a bool tensor is not supported. #143

Open
WilliamKRobert opened this issue Jun 18, 2021 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@WilliamKRobert
Copy link

When I try to feed the cheb_conv with SparseTensor, I got the following errors:

   x = self.model(x, sparse_adj_mat)
  File "/home/user/miniconda2/envs/myenvlib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "./net.py", line 121, in forward
    x = F.relu(self.conv1(x, sparse_adj_mat))
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch_geometric/nn/conv/cheb_conv.py", line 126, in forward
    edge_index, norm = self.__norm__(edge_index, x.size(self.node_dim),
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch_geometric/nn/conv/cheb_conv.py", line 93, in __norm__
    edge_index, edge_weight = remove_self_loops(edge_index, edge_weight)
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch_geometric/utils/loop.py", line 33, in remove_self_loops
    edge_index = edge_index[:, mask]
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch_sparse/tensor.py", line 464, in __getitem__
    out = out.select(dim, item)
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch_sparse/select.py", line 9, in <lambda>
    SparseTensor.select = lambda self, dim, idx: select(self, dim, idx)
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch_sparse/select.py", line 6, in select
    return narrow(src, dim, start=idx, length=1)
  File "/home/user/miniconda2/envs/myenv/lib/python3.8/site-packages/torch_sparse/narrow.py", line 51, in narrow
    col = col[mask] - start
RuntimeError: Subtraction, the `-` operator, with a bool tensor is not supported. If you are trying to invert a mask, use the `~` or `logical_not()` operator instead.

Looks like cheb_conv does not support SparseTensor. Other GNN (e.g. sgc) works fine with my SparseTensorinput. The error is triggered when the variable start becomes a bool value though it was int in the first few iterations of remove_self_loops.

@rusty1s
Copy link
Owner

rusty1s commented Jun 19, 2021

You are right, ChebConv currently does not support SparseTensor yet. I'm sorry. Will try to fix it ASAP.

@rusty1s rusty1s added the enhancement New feature or request label Sep 16, 2021
RexYing pushed a commit to RexYing/pytorch_sparse that referenced this issue Apr 26, 2022
* add data

* move

* readme

* description + metadata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants