Skip to content

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

Description

@WilliamKRobert

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions