Giter Site home page Giter Site logo

rusty1s / pytorch_cluster Goto Github PK

View Code? Open in Web Editor NEW
767.0 767.0 139.0 2.63 MB

PyTorch Extension Library of Optimized Graph Cluster Algorithms

License: MIT License

Python 25.37% Cuda 14.85% C++ 55.36% C 1.57% Shell 0.85% CMake 2.00%
cluster-algorithms geometric-deep-learning graph-neural-networks pytorch

pytorch_cluster's Introduction



PyPI Version Testing Status Linting Status Docs Status Contributing Slack

Founding Engineer 🤓 @ kumo.ai - PhD from TU Dortmund University

  • 👨🏼‍💻 I love coding and learning new things
  • 🤩 I'm interested in

pytorch_cluster's People

Contributors

agarwalsaurav avatar aicentral avatar amitt1236 avatar antoineprv avatar cimadure avatar dawars avatar dkbhaskaran avatar dsciebu avatar g-morishita avatar gericovi avatar hjlin0515 avatar jlevy44 avatar juftin avatar justanhduc avatar kuynzereb avatar lgray avatar liaopeiyuan avatar luwei0917 avatar mdiephuis avatar mludolph avatar pbielak avatar piercelbrooks avatar piotrchmiel avatar pultar avatar rusty1s avatar sebp avatar viktortnk avatar vuenc avatar yanbing-j avatar yoannpitarch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pytorch_cluster's Issues

unable to execute '/usr/local/cuda:/bin/nvcc': No such file or directory

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared -B /home/gautam/anaconda3/compiler_compat -L/home/gautam/anaconda3/lib -Wl,-rpath=/home/gautam/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/cpu/sampler.o -o build/lib.linux-x86_64-3.7/torch_cluster/sampler_cpu.cpython-37m-x86_64-linux-gnu.so
building 'torch_cluster.graclus_cuda' extension
creating build/temp.linux-x86_64-3.7/cuda
gcc -pthread -B /home/gautam/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include/TH -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda:/include -I/home/gautam/anaconda3/include/python3.7m -c cuda/graclus.cpp -o build/temp.linux-x86_64-3.7/cuda/graclus.o -DVERSION_GE_1_3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=graclus_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda:/bin/nvcc -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include/TH -I/home/gautam/anaconda3/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda:/include -I/home/gautam/anaconda3/include/python3.7m -c cuda/graclus_kernel.cu -o build/temp.linux-x86_64-3.7/cuda/graclus_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DVERSION_GE_1_3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=graclus_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++11
unable to execute '/usr/local/cuda:/bin/nvcc': No such file or directory
error: command '/usr/local/cuda:/bin/nvcc' failed with exit status 1

System Details:
Python 3.7
CUDA 10.0
NVCC working

I think it's the colon in the address that's messing my installation?

RuntimeError: expected scalar type Long but found Float

Hi,

I have this issue.

This is the code:

batch = torch.tensor(np.zeros(len(target)), dtype=torch.float)
target_tensor = torch.tensor(target, dtype=torch.float)
indices = fps(target_tensor, batch, ratio=0.5, random_start=False)

and this is the error:
RuntimeError: expected scalar type Long but found Float (data_ptr at /hardmnt/bumblebee1/data/fabio/research/DenseFusion/venv2/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:5747)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x33 (0x7f2282e1a813 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch/lib/libc10.so)
frame #1: long* at::Tensor::data_ptr() const + 0x16c (0x7f22106fdb8c in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #2: fps(at::Tensor, at::Tensor, float, bool) + 0x76 (0x7f22106fa116 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #3: + 0x22df4 (0x7f221070fdf4 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #4: + 0x2302e (0x7f221071002e in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #5: + 0x1f656 (0x7f221070c656 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #6: PyCFunction_Call + 0x77 (0x4e1307 in /home/poiesi/data/research/DenseFusion/venv2/bin/python)
...

Any guess?
Thanks

Get wrong results when running random walk on gpu

Hi, I got an issue when running random walk on gpu. Plz help!
The demo below can reproduce the issue.

import torch
from torch_cluster import random_walk

device = 'cpu'
# device = 'cuda:0'

num_nodes = 3
walk_length = 3
p = 1
q = 1
edge_index = torch.tensor([[0, 1, 1, 2], [1, 0, 2, 1]]).to(device)
subset = torch.arange(num_nodes, device=edge_index.device)

rw = random_walk(edge_index[0], edge_index[1], subset,
                         walk_length, p, q, num_nodes)
print(rw)

There are three nodes and two edges in the graph. When I ran this code on cpu, I got the following results:

tensor([[0, 1, 0, 1],
        [1, 0, 1, 0],
        [2, 1, 2, 1]])

However, when I ran this code on gpu, the results became:

tensor([[-1, -1, -1, -1],
        [-1, -1, -1, -1],
        [-1, -1, -1, -1]], device='cuda:0')

Do you have any idea about it?

some errors about knn_graph

File "/opt/data/private/code/EDSR-PyTorch-master/src/model/net.py", line 107, in forward
edge_index = knn_graph(node, k)
File "/usr/local/anaconda3/envs/py36/lib/python3.6/site-packages/torch_cluster/knn.py", line 123, in knn_graph
row, col = knn(x, x, k if loop else k + 1, batch, batch, cosine=cosine)
File "/usr/local/anaconda3/envs/py36/lib/python3.6/site-packages/torch_cluster/knn.py", line 66, in knn
min_xy = min(x.min().item(), y.min().item())
RuntimeError: invalid argument 1: cannot perform reduction function min on tensor with no elements because the operation does not have an identity at /opt/conda/conda-bld/pytorch_1579027003190/work/aten/src/TH/generic/THTensorEvenMoreMath.cpp:345

Strange behaviour in radius_kernel.cu

Hi,

I face a very strange behaviour with the radius_kernel.cu on MASTER causing different results on CPU and GPU.
My Test-Scenario is as follows:

import numpy as np 
from torch_geometric.nn import radius
import torch

def grid3d(m, dtype=np.float32):
    x_ = np.linspace(-1, 1, m)
    y_ = np.linspace(-1, 1, m)
    z_ = np.linspace(-1, 1, m)
    x, y, z = np.meshgrid(x_, y_, z_, indexing='ij')
    P = np.array([x,y,z]).T.reshape(-1, 3)
    return P


# transform to pytorch
# transform to pytorch
grid = torch.from_numpy(grid3d(100)).float()
centroids = torch.from_numpy(np.array([[0.5,0.5,0.5],
                                       [0.5,1.0,5.0],
                                       [1.0,1.0,1.0],
                                       [0.5,1.0,0.0]])).float()

batch_grid = torch.from_numpy(np.zeros(grid.shape[0])).long()
batch_centroids = torch.from_numpy(np.zeros(centroids.shape[0])).long()

# compute radius search
edge_index = radius(grid, centroids, 0.5,  batch_grid, batch_centroids, max_num_neighbors=32)  
retrieved_points = grid[edge_index[1].unique()]
returned_centroids = centroids[edge_index[0].unique()]

# tp numpy
retrieved_points_cpu = retrieved_points.cpu().numpy()
returned_centroids_cpu = returned_centroids.cpu().numpy()


# compute radius search
device = "cuda"
edge_index = radius(grid.to(device), centroids.to(device), 0.5,  batch_grid.to(device), batch_centroids.to(device), max_num_neighbors=32)  
retrieved_points = grid[edge_index[1].unique()]
returned_centroids = centroids[edge_index[0].unique()]

# tp numpy
retrieved_points_gpu = retrieved_points.cpu().numpy()
returned_centroids_gpu = returned_centroids.cpu().numpy()


assert np.allclose(retrieved_points_cpu, retrieved_points_gpu)
assert np.allclose(returned_centroids_cpu, returned_centroids_gpu)

I searched a lot and it seems that the inner loop of radius_kernel.cu runs too often.
This results in too many comparisons and some points are retrieved multiple times.

Do you have an idea what causes the following debug-output?

  for (ptrdiff_t n_y = start_idx_y + idx; n_y < end_idx_y; n_y += THREADS) {
    size_t count = 0;
    printf("Before ny %d: batch_idx: %d \n idx: %d \n start_idx_x: %d \n end_idx_x: %d  \n start_idx_y: %d  \n end_idx_y: %d \n", n_y, batch_idx, idx, start_idx_x, end_idx_x, start_idx_y, end_idx_y);
    for (ptrdiff_t n_x = start_idx_x ; n_x < end_idx_x; n_x++) {
      printf("WTF?? nx %d: batch_idx: %d \n idx: %d \n start_idx_x: %d \n end_idx_x: %d  \n start_idx_y: %d  \n end_idx_y: %d \n", n_x, batch_idx, idx, start_idx_x, end_idx_x, start_idx_y, end_idx_y);
      /**
       *  > out.txt
       *  WTF??  nx 1: batch_idx: 0 
          idx: 0 
          start_idx_x: 0 
          end_idx_x: 0  
          start_idx_y: 0  
          end_idx_y: 0 
       */ 
     ...

This printf should never occur or what am I overseeing?

EDIT

My failure was that I tried to printf with %d specifier which is wrong. %ld is the right for ptrdiff_t datatype (assuming a long cast e.g. (long) start_idx_x).
The correct printf is:
printf("WTF? nx %ld: batch_idx: %ld \n idx: %ld \n start_idx_x: %ld \n end_idx_x: %ld \n start_idx_y: %ld \n end_idx_y: %ld \n", (long) n_x, (long) batch_idx, (long) idx, (long) start_idx_x, (long) end_idx_x, (long) start_idx_y, (long) end_idx_y);

Anyway, the function still returns different results for CPU and GPU. I updated the test-case.

Best regards,
Matthias

Issue in SplineCNN while clustering

Hi,
I was using the SplineCNN with InMemoryDataset for one of my own datasets. I am getting the following errror in training while using graclus:

THCudaCheck FAIL file=aten/THC/generic/THCDegree.cuh line=23 error=11 : invalid argument
Traceback (most recent call last):
File "BACH.py", line 96, in
train(epoch)
File "BACH.py", line 75, in train
out = model(data)
File "/home/Drive2/shrey/shrey/venvSpline/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "BACH.py", line 40, in forward
cluster = graclus(data.edge_index, weight, data.x.size(0))
File "/home/Drive2/shrey/shrey/venvSpline/local/lib/python2.7/site-packages/torch_geometric/nn/pool/graclus.py", line 6, in graclus
return graclus_cluster(row, col, weight, num_nodes)
File "/home/Drive2/shrey/shrey/venvSpline/local/lib/python2.7/site-packages/torch_cluster/graclus.py", line 34, in graclus_cluster
graclus(cluster, row, col, weight)
File "/home/Drive2/shrey/shrey/venvSpline/local/lib/python2.7/site-packages/torch_cluster/utils/ffi.py", line 12, in graclus
func(self, row, col) if weight is None else func(self, row, col, weight)
File "/home/Drive2/shrey/shrey/venvSpline/local/lib/python2.7/site-packages/torch/utils/ffi/init.py", line 202, in safe_call
result = torch._C._safe_call(*args, **kwargs)
torch.FatalError: cuda runtime error (11) : invalid argument at aten/THC/generic/THCDegree.cuh:23

The error pops up for one of the graph everytime (I am currently using batch size = 1 with no shuffling). Note that the no of nodes in each graph is same.

Any help in this regard would be appreciated. Thanks

How to make sure it runs on cuda

I am using an anaconda environment.

These do not hold true for me:

$ echo $PATH
>>> /usr/local/cuda/bin:...

$ echo $CPATH
>>> /usr/local/cuda/include:...

I believe the current code is not working on GPU. How can I make sure I can run it on the GPU?

Also, I installed using pip so I can't run this command either:
python setup.py test

Thanks

Issue with KNN on cuda:1

Hey rusty,

I am trying to use a gpu at "cuda:1" instead of "cuda:0", and it seems that whenever I do so the knn calculation fails, throwing this error:

/usr/local/lib/python3.7/dist-packages/torch_cluster/knn.py in knn(x, y, k, batch_x, batch_y)
55
56 if x.is_cuda:
---> 57 return torch_cluster.knn_cuda.knn(x, y, k, batch_x, batch_y)
58
59 # Rescale x and y.

RuntimeError: CUDA error: an illegal memory access was encountered (free_blocks at /pytorch/aten/src/THC/THCCachingAllocator.cpp:439)
frame #0: std::function<std::string ()>::operator()() const + 0x11 (0x7f68e9bbb021 in /usr/local/lib/python3.7/dist-packages/torch/lib/libc10.so)
frame #1: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x2a (0x7f68e9bba8ea in /usr/local/lib/python3.7/dist-packages/torch/lib/libc10.so)
frame #2: + 0x13f295d (0x7f68f513b95d in /usr/local/lib/python3.7/dist-packages/torch/lib/libcaffe2_gpu.so)
frame #3: + 0x13f79df (0x7f68f51409df in /usr/local/lib/python3.7/dist-packages/torch/lib/libcaffe2_gpu.so)
frame #4: + 0x13f900a (0x7f68f514200a in /usr/local/lib/python3.7/dist-packages/torch/lib/libcaffe2_gpu.so)
frame #5: at::native::empty_cuda(c10::ArrayRef, at::TensorOptions const&) + 0x36b (0x7f68f64007fb in /usr/local/lib/python3.7/dist-packages/torch/lib/libcaffe2_gpu.so)
frame #6: at::CUDALongType::empty(c10::ArrayRef, at::TensorOptions const&) const + 0x4d (0x7f68f50fadad in /usr/local/lib/python3.7/dist-packages/torch/lib/libcaffe2_gpu.so)
frame #7: torch::autograd::VariableType::empty(c10::ArrayRef, at::TensorOptions const&) const + 0x179 (0x7f68e8e7c2b9 in /usr/local/lib/python3.7/dist-packages/torch/lib/libtorch.so.1)
frame #8: at::native::zeros(c10::ArrayRef, at::TensorOptions const&) + 0x40 (0x7f68ea74c470 in /usr/local/lib/python3.7/dist-packages/torch/lib/libcaffe2.so)
frame #9: + 0x1dc5e (0x7f68c1aadc5e in /usr/local/lib/python3.7/dist-packages/torch_cluster/knn_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #10: degree(at::Tensor, long) + 0x63 (0x7f68c1aae405 in /usr/local/lib/python3.7/dist-packages/torch_cluster/knn_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #11: knn_cuda(at::Tensor, at::Tensor, unsigned long, at::Tensor, at::Tensor) + 0xf7 (0x7f68c1aaf226 in /usr/local/lib/python3.7/dist-packages/torch_cluster/knn_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #12: knn(at::Tensor, at::Tensor, unsigned long, at::Tensor, at::Tensor) + 0x134 (0x7f68c1aa1324 in /usr/local/lib/python3.7/dist-packages/torch_cluster/knn_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #13: + 0x1cc7b (0x7f68c1aacc7b in /usr/local/lib/python3.7/dist-packages/torch_cluster/knn_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #14: + 0x19ed7 (0x7f68c1aa9ed7 in /usr/local/lib/python3.7/dist-packages/torch_cluster/knn_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #15: _PyMethodDef_RawFastCallKeywords + 0x24c (0x560d17abfc9c in /usr/bin/python3.7)
frame #16: _PyCFunction_FastCallKeywords + 0x20 (0x560d17abfa30 in /usr/bin/python3.7)
frame #17: _PyEval_EvalFrameDefault + 0x4ae9 (0x560d17b351f9 in /usr/bin/python3.7)
frame #18: _PyEval_EvalCodeWithName + 0x2df (0x560d17b2fccf in /usr/bin/python3.7)
frame #19: _PyFunction_FastCallKeywords + 0x1ea (0x560d17ac13ea in /usr/bin/python3.7)
frame #20: _PyEval_EvalFrameDefault + 0x43e (0x560d17b30b4e in /usr/bin/python3.7)
frame #21: _PyEval_EvalCodeWithName + 0x2df (0x560d17b2fccf in /usr/bin/python3.7)
frame #22: _PyFunction_FastCallKeywords + 0x1ea (0x560d17ac13ea in /usr/bin/python3.7)
frame #23: _PyEval_EvalFrameDefault + 0x12db (0x560d17b319eb in /usr/bin/python3.7)
frame #24: _PyEval_EvalCodeWithName + 0x475 (0x560d17b2fe65 in /usr/bin/python3.7)
frame #25: _PyObject_Call_Prepend + 0x347 (0x560d17ac1ab7 in /usr/bin/python3.7)
frame #26: PyObject_Call + 0xb8 (0x560d17ac1ea8 in /usr/bin/python3.7)
frame #27: _PyEval_EvalFrameDefault + 0x1bbf (0x560d17b322cf in /usr/bin/python3.7)
frame #28: _PyEval_EvalCodeWithName + 0x2df (0x560d17b2fccf in /usr/bin/python3.7)
frame #29: _PyObject_Call_Prepend + 0x347 (0x560d17ac1ab7 in /usr/bin/python3.7)
frame #30: + 0x17a999 (0x560d17b06999 in /usr/bin/python3.7)
frame #31: _PyObject_FastCallKeywords + 0x92 (0x560d17ac0442 in /usr/bin/python3.7)
frame #32: _PyEval_EvalFrameDefault + 0x4efd (0x560d17b3560d in /usr/bin/python3.7)
frame #33: _PyObject_Call_Prepend + 0x105 (0x560d17ac1875 in /usr/bin/python3.7)
frame #34: PyObject_Call + 0xb8 (0x560d17ac1ea8 in /usr/bin/python3.7)
frame #35: _PyEval_EvalFrameDefault + 0x1bbf (0x560d17b322cf in /usr/bin/python3.7)
frame #36: _PyEval_EvalCodeWithName + 0x2df (0x560d17b2fccf in /usr/bin/python3.7)
frame #37: _PyObject_Call_Prepend + 0x347 (0x560d17ac1ab7 in /usr/bin/python3.7)
frame #38: + 0x17a999 (0x560d17b06999 in /usr/bin/python3.7)
frame #39: _PyObject_FastCallKeywords + 0x92 (0x560d17ac0442 in /usr/bin/python3.7)
frame #40: _PyEval_EvalFrameDefault + 0x4695 (0x560d17b34da5 in /usr/bin/python3.7)
frame #41: _PyEval_EvalCodeWithName + 0x2df (0x560d17b2fccf in /usr/bin/python3.7)
frame #42: PyEval_EvalCode + 0x23 (0x560d17b2f9e3 in /usr/bin/python3.7)
frame #43: + 0x1a1d93 (0x560d17b2dd93 in /usr/bin/python3.7)
frame #44: _PyMethodDef_RawFastCallKeywords + 0x6d (0x560d17abfabd in /usr/bin/python3.7)
frame #45: _PyCFunction_FastCallKeywords + 0x20 (0x560d17abfa30 in /usr/bin/python3.7)
frame #46: _PyEval_EvalFrameDefault + 0x4383 (0x560d17b34a93 in /usr/bin/python3.7)
frame #47: _PyGen_Send + 0x295 (0x560d17bbc3c5 in /usr/bin/python3.7)
frame #48: _PyEval_EvalFrameDefault + 0x1652 (0x560d17b31d62 in /usr/bin/python3.7)
frame #49: _PyGen_Send + 0x295 (0x560d17bbc3c5 in /usr/bin/python3.7)
frame #50: _PyEval_EvalFrameDefault + 0x1652 (0x560d17b31d62 in /usr/bin/python3.7)
frame #51: _PyGen_Send + 0x295 (0x560d17bbc3c5 in /usr/bin/python3.7)
frame #52: _PyMethodDef_RawFastCallKeywords + 0xe9 (0x560d17abfb39 in /usr/bin/python3.7)
frame #53: _PyMethodDescr_FastCallKeywords + 0x4d (0x560d17bba4ad in /usr/bin/python3.7)
frame #54: _PyEval_EvalFrameDefault + 0x48d9 (0x560d17b34fe9 in /usr/bin/python3.7)
frame #55: _PyFunction_FastCallKeywords + 0x10a (0x560d17ac130a in /usr/bin/python3.7)
frame #56: _PyEval_EvalFrameDefault + 0x43e (0x560d17b30b4e in /usr/bin/python3.7)
frame #57: _PyFunction_FastCallKeywords + 0x10a (0x560d17ac130a in /usr/bin/python3.7)
frame #58: _PyEval_EvalFrameDefault + 0x697 (0x560d17b30da7 in /usr/bin/python3.7)
frame #59: _PyEval_EvalCodeWithName + 0x2df (0x560d17b2fccf in /usr/bin/python3.7)
frame #60: _PyObject_Call_Prepend + 0x533 (0x560d17ac1ca3 in /usr/bin/python3.7)
frame #61: PyObject_Call + 0xb8 (0x560d17ac1ea8 in /usr/bin/python3.7)
frame #62: _PyEval_EvalFrameDefault + 0x1bbf (0x560d17b322cf in /usr/bin/python3.7)
frame #63: _PyEval_EvalCodeWithName + 0x475 (0x560d17b2fe65 in /usr/bin/python3.7)

I really don't know CUDA, so sadly I can't be of any further help. It seems to me like you call the malloc on the wrong GPU, maybe?

Thanks a lot for all your work!

import error from torch_cluster import neighbor_sampler

Hi, I just updated torch_geometric and torch_cluster to latest versions. However I am getting an error while importing neighbor_sampler.
/torch_geometric/data/sampler.py calls neighbor_sampler which is no more there in torch_cluster.
What versions should I use here?

No module named 'torch_cluster.graclus_cpu'

Hi @rusty1s ,
I am trying to install torch-cluster to use with torch-geometric on Mac with no gpu.
My pytorch version is 1.4.0 and I'm running inside an anaconda environment with python 3.6.10.

I installed torch_cluster, torch_sparse, torch_scatter and torch-geometric using the following lines from the installation instructions of geometric.

CUDA=cpu
pip install torch-scatter==latest+${CUDA} torch-sparse==latest+${CUDA} -f https://s3.eu-central-1.amazonaws.com/pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-cluster
pip install torch-geometric

I also modified the def spawn(self, cmd): command as explained here (before that, I had trouble installing some of the dependencies).

Installation succeeded.
I then start a python interpreter, import torch first, and then when I import torch_geometric I am getting the error that No module named 'torch_cluster.graclus_cpu' (see full log below).

I did manage to import torch_geometric when I installed torch_cluster==1.2.0 and torch_geometric==1.3.0, but this raised other problems while running the actual network.

Any idea? Thanks!

Full log:

Python 3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 15:01:53) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torch_geometric
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/urialon/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch_geometric/__init__.py", line 2, in <module>
    import torch_geometric.nn
  File "/Users/urialon/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch_geometric/nn/__init__.py", line 2, in <module>
    from .data_parallel import DataParallel
  File "/Users/urialon/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch_geometric/nn/data_parallel.py", line 5, in <module>
    from torch_geometric.data import Batch
  File "/Users/urialon/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch_geometric/data/__init__.py", line 6, in <module>
    from .sampler import NeighborSampler
  File "/Users/urialon/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch_geometric/data/sampler.py", line 5, in <module>
    from torch_cluster import neighbor_sampler
  File "/Users/urialon/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch_cluster/__init__.py", line 1, in <module>
    from .graclus import graclus_cluster
  File "/Users/urialon/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch_cluster/graclus.py", line 2, in <module>
    import torch_cluster.graclus_cpu
ModuleNotFoundError: No module named 'torch_cluster.graclus_cpu'

ModuleNotFoundError: No module named 'torch_cluster.graclus_cuda'

Hi,

I have installed CUDA manually (as it was suggested in other issues), and it seems to be working fine:

shmyg@test-pc:~$ /usr/local/cuda-10.2/samples/bin/x86_64/linux/release/deviceQuery
/usr/local/cuda-10.2/samples/bin/x86_64/linux/release/deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 1050"
  CUDA Driver Version / Runtime Version          10.2 / 10.2
  CUDA Capability Major/Minor version number:    6.1
  Total amount of global memory:                 1997 MBytes (2094202880 bytes)
  ( 5) Multiprocessors, (128) CUDA Cores/MP:     640 CUDA Cores
  GPU Max Clock rate:                            1455 MHz (1.46 GHz)
  Memory Clock rate:                             3504 Mhz
  Memory Bus Width:                              128-bit
  L2 Cache Size:                                 1048576 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 2 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device supports Compute Preemption:            Yes
  Supports Cooperative Kernel Launch:            Yes
  Supports MultiDevice Co-op Kernel Launch:      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.2, CUDA Runtime Version = 10.2, NumDevs = 1
Result = PASS

I've also checked all the environment variables:

shmyg@test-pc:~$ echo $PATH

/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda/bin

shmyg@test-pc:~$ echo $CPATH

/usr/local/cuda/bin/include

But when I'm trying to use torch_cluster, it fails:

>>>import torch
>>>from torch_cluster import graclus_cluster
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/shmyg/.local/lib/python3.6/site-packages/torch_cluster/__init__.py", line 1, in <module>
    from .graclus import graclus_cluster
  File "/home/shmyg/.local/lib/python3.6/site-packages/torch_cluster/graclus.py", line 5, in <module>
    import torch_cluster.graclus_cuda
ModuleNotFoundError: No module named 'torch_cluster.graclus_cuda'`

What am I doing wrong?

Compilation error during install

Hi, first off thank you for this work, it looks very useful.
I'm trying to get the torch-geometry package to work but torch-cluster fails to compile.

$ pipenv run python --version
Python 3.7.0b2

$ pipenv run python -c "import torch; print(torch.__version__)"
0.4.1.post2

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Tue_Jun_12_23:07:04_CDT_2018
Cuda compilation tools, release 9.2, V9.2.148

I get following error message:

$ pipenv install torch-cluster
Installing torch-cluster...
Collecting torch-cluster
  Using cached https://files.pythonhosted.org/packages/36/b0/25ca8b811059e001f1e3285ac3036b6969fb21350e411c6881ba2b9be3c3/torch_cluster-1.1.2.tar.gz
Requirement already satisfied: cffi in /home/philipp/dotfiles/stow/t460p/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages (from torch-cluster) (1.11.5)
Requirement already satisfied: pycparser in /home/philipp/dotfiles/stow/t460p/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages (from cffi->torch-cluster) (2.18)
Building wheels for collected packages: torch-cluster
  Running setup.py bdist_wheel for torch-cluster: started
  Running setup.py bdist_wheel for torch-cluster: finished with status 'error'
  Complete output from command /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/bin/python3.7m -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p1cl3unl/torch-cluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-exs4dzw9 --python-tag cp37:
  Compiling kernel...
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/torch_cluster
  copying torch_cluster/graclus.py -> build/lib.linux-x86_64-3.7/torch_cluster
  copying torch_cluster/__init__.py -> build/lib.linux-x86_64-3.7/torch_cluster
  copying torch_cluster/grid.py -> build/lib.linux-x86_64-3.7/torch_cluster
  creating build/lib.linux-x86_64-3.7/test
  copying test/test_graclus.py -> build/lib.linux-x86_64-3.7/test
  copying test/utils.py -> build/lib.linux-x86_64-3.7/test
  copying test/__init__.py -> build/lib.linux-x86_64-3.7/test
  copying test/test_grid.py -> build/lib.linux-x86_64-3.7/test
  creating build/lib.linux-x86_64-3.7/torch_cluster/_ext
  copying torch_cluster/_ext/__init__.py -> build/lib.linux-x86_64-3.7/torch_cluster/_ext
  creating build/lib.linux-x86_64-3.7/torch_cluster/utils
  copying torch_cluster/utils/ffi.py -> build/lib.linux-x86_64-3.7/torch_cluster/utils
  copying torch_cluster/utils/loop.py -> build/lib.linux-x86_64-3.7/torch_cluster/utils
  copying torch_cluster/utils/perm.py -> build/lib.linux-x86_64-3.7/torch_cluster/utils
  copying torch_cluster/utils/__init__.py -> build/lib.linux-x86_64-3.7/torch_cluster/utils
  creating build/lib.linux-x86_64-3.7/torch_cluster/_ext/ffi
  copying torch_cluster/_ext/ffi/__init__.py -> build/lib.linux-x86_64-3.7/torch_cluster/_ext/ffi
  warning: build_py: byte-compiling is disabled, skipping.
  
  running build_ext
  generating cffi module 'build/temp.linux-x86_64-3.7/torch_cluster._ext.ffi._ffi.c'
  creating build/temp.linux-x86_64-3.7
  building 'torch_cluster._ext.ffi._ffi' extension
  creating build/temp.linux-x86_64-3.7/build
  creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/tmp
  creating build/temp.linux-x86_64-3.7/tmp/pip-install-p1cl3unl
  creating build/temp.linux-x86_64-3.7/tmp/pip-install-p1cl3unl/torch-cluster
  creating build/temp.linux-x86_64-3.7/tmp/pip-install-p1cl3unl/torch-cluster/aten
  creating build/temp.linux-x86_64-3.7/tmp/pip-install-p1cl3unl/torch-cluster/aten/TH
  creating build/temp.linux-x86_64-3.7/tmp/pip-install-p1cl3unl/torch-cluster/aten/THCC
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -Iaten/TH -Iaten/THCC -I/home/philipp/.pyenv/versions/3.7.0b2/include/python3.7m -c build/temp.linux-x86_64-3.7/torch_cluster._ext.ffi._ffi.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/torch_cluster._ext.ffi._ffi.o -std=c99 -std=c99
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -Iaten/TH -Iaten/THCC -I/home/philipp/.pyenv/versions/3.7.0b2/include/python3.7m -c /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGraclus.c -o build/temp.linux-x86_64-3.7/tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGraclus.o -std=c99 -std=c99
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -Iaten/TH -Iaten/THCC -I/home/philipp/.pyenv/versions/3.7.0b2/include/python3.7m -c /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c -o build/temp.linux-x86_64-3.7/tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.o -std=c99 -std=c99
  In file included from generic/THGrid.c:1:0,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateFloatTypes.h:10,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:10,
                   from /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c:4:
  aten/TH/generic/THGrid.c: In function ‘THFloatTensor_grid’:
  aten/TH/generic/THGrid.c:15:49: error: dereferencing pointer to incomplete type ‘THTensor {aka struct THTensor}’
         value += coef * (int64_t) (posData[d * pos->stride[1]] / sizeData[d]);
                                                   ^~
  aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
     real *posData = THTensor_(data)(pos);
           ^~~~~~~
  In file included from generic/THGrid.c:1:0,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateFloatTypes.h:11,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:10,
                   from /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c:4:
  aten/TH/generic/THGrid.c: In function ‘THDoubleTensor_grid’:
  aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
     real *posData = THTensor_(data)(pos);
           ^~~~~~~
  In file included from generic/THGrid.c:1:0,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:10,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                   from /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c:4:
  aten/TH/generic/THGrid.c: In function ‘THByteTensor_grid’:
  aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
     real *posData = THTensor_(data)(pos);
           ^~~~~~~
  In file included from generic/THGrid.c:1:0,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:11,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                   from /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c:4:
  aten/TH/generic/THGrid.c: In function ‘THCharTensor_grid’:
  aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
     real *posData = THTensor_(data)(pos);
           ^~~~~~~
  In file included from generic/THGrid.c:1:0,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:12,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                   from /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c:4:
  aten/TH/generic/THGrid.c: In function ‘THShortTensor_grid’:
  aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
     real *posData = THTensor_(data)(pos);
           ^~~~~~~
  In file included from generic/THGrid.c:1:0,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:13,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                   from /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c:4:
  aten/TH/generic/THGrid.c: In function ‘THIntTensor_grid’:
  aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
     real *posData = THTensor_(data)(pos);
           ^~~~~~~
  In file included from generic/THGrid.c:1:0,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:14,
                   from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                   from /tmp/pip-install-p1cl3unl/torch-cluster/aten/TH/THGrid.c:4:
  aten/TH/generic/THGrid.c: In function ‘THLongTensor_grid’:
  aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
     real *posData = THTensor_(data)(pos);
           ^~~~~~~
  error: command 'gcc' failed with exit status 1

I also tried to install from source, with pretty much the same error:

$ pipenv install --dev -e ~/tmp/pytorch_cluster
Installing -e /home/philipp/tmp/pytorch_cluster...
Obtaining file:///home/philipp/tmp/pytorch_cluster
Requirement already satisfied: cffi in /home/philipp/dotfiles/stow/t460p/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages (from torch-cluster==1.1.2) (1.11.5)
Requirement already satisfied: pycparser in /home/philipp/dotfiles/stow/t460p/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages (from cffi->torch-cluster==1.1.2) (2.18)
Installing collected packages: torch-cluster
  Running setup.py develop for torch-cluster
    Complete output from command /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/bin/python3.7m -c "import setuptools, tokenize;__file__='/home/philipp/tmp/pytorch_cluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
    Compiling kernel...
    running develop
    running egg_info
    writing torch_cluster.egg-info/PKG-INFO
    writing dependency_links to torch_cluster.egg-info/dependency_links.txt
    writing requirements to torch_cluster.egg-info/requires.txt
    writing top-level names to torch_cluster.egg-info/top_level.txt
    reading manifest file 'torch_cluster.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'torch_cluster.egg-info/SOURCES.txt'
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-3.7/torch_cluster._ext.ffi._ffi.c'
    creating build/temp.linux-x86_64-3.7
    building 'torch_cluster._ext.ffi._ffi' extension
    creating build/temp.linux-x86_64-3.7/build
    creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/home
    creating build/temp.linux-x86_64-3.7/home/philipp
    creating build/temp.linux-x86_64-3.7/home/philipp/tmp
    creating build/temp.linux-x86_64-3.7/home/philipp/tmp/pytorch_cluster
    creating build/temp.linux-x86_64-3.7/home/philipp/tmp/pytorch_cluster/aten
    creating build/temp.linux-x86_64-3.7/home/philipp/tmp/pytorch_cluster/aten/TH
    creating build/temp.linux-x86_64-3.7/home/philipp/tmp/pytorch_cluster/aten/THCC
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -Iaten/TH -Iaten/THCC -I/home/philipp/.pyenv/versions/3.7.0b2/include/python3.7m -c build/temp.linux-x86_64-3.7/torch_cluster._ext.ffi._ffi.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/torch_cluster._ext.ffi._ffi.o -std=c99 -std=c99
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -Iaten/TH -Iaten/THCC -I/home/philipp/.pyenv/versions/3.7.0b2/include/python3.7m -c /home/philipp/tmp/pytorch_cluster/aten/TH/THGraclus.c -o build/temp.linux-x86_64-3.7/home/philipp/tmp/pytorch_cluster/aten/TH/THGraclus.o -std=c99 -std=c99
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -Iaten/TH -Iaten/THCC -I/home/philipp/.pyenv/versions/3.7.0b2/include/python3.7m -c /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c -o build/temp.linux-x86_64-3.7/home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.o -std=c99 -std=c99
    In file included from generic/THGrid.c:1:0,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateFloatTypes.h:10,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:10,
                     from /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c:4:
    aten/TH/generic/THGrid.c: In function ‘THFloatTensor_grid’:
    aten/TH/generic/THGrid.c:15:49: error: dereferencing pointer to incomplete type ‘THTensor {aka struct THTensor}’
           value += coef * (int64_t) (posData[d * pos->stride[1]] / sizeData[d]);
                                                     ^~
    aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
       real *posData = THTensor_(data)(pos);
             ^~~~~~~
    In file included from generic/THGrid.c:1:0,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateFloatTypes.h:11,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:10,
                     from /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c:4:
    aten/TH/generic/THGrid.c: In function ‘THDoubleTensor_grid’:
    aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
       real *posData = THTensor_(data)(pos);
             ^~~~~~~
    In file included from generic/THGrid.c:1:0,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:10,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                     from /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c:4:
    aten/TH/generic/THGrid.c: In function ‘THByteTensor_grid’:
    aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
       real *posData = THTensor_(data)(pos);
             ^~~~~~~
    In file included from generic/THGrid.c:1:0,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:11,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                     from /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c:4:
    aten/TH/generic/THGrid.c: In function ‘THCharTensor_grid’:
    aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
       real *posData = THTensor_(data)(pos);
             ^~~~~~~
    In file included from generic/THGrid.c:1:0,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:12,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                     from /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c:4:
    aten/TH/generic/THGrid.c: In function ‘THShortTensor_grid’:
    aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
       real *posData = THTensor_(data)(pos);
             ^~~~~~~
    In file included from generic/THGrid.c:1:0,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:13,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                     from /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c:4:
    aten/TH/generic/THGrid.c: In function ‘THIntTensor_grid’:
    aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
       real *posData = THTensor_(data)(pos);
             ^~~~~~~
    In file included from generic/THGrid.c:1:0,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateIntTypes.h:14,
                     from /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateAllTypes.h:11,
                     from /home/philipp/tmp/pytorch_cluster/aten/TH/THGrid.c:4:
    aten/TH/generic/THGrid.c: In function ‘THLongTensor_grid’:
    aten/TH/generic/THGrid.c:7:9: warning: variable ‘posData’ set but not used [-Wunused-but-set-variable]
       real *posData = THTensor_(data)(pos);
             ^~~~~~~
    error: command 'gcc' failed with exit status 1

I got all other dependencies of torch-geometry to work but I'm failing here.
Would appreciate your support.

Also torch-spline-conv only installed from source but not from pypi, where I get a similar compilation error. I can add another issue if needed.

No module named 'torch_cluster.graclus_cuda'

I Install the library using pip3 install torch-cluster.

When using the library using from torch_cluster import knn_graph I get:

Traceback (most recent call last):
  File "/home/jonathan/workspace/pcnn/models/Hybrid.py", line 9, in <module>
    from torch_cluster import knn_graph
  File "/home/jonathan/.local/lib/python3.6/site-packages/torch_cluster/__init__.py", line 1, in <module>
    from .graclus import graclus_cluster
  File "/home/jonathan/.local/lib/python3.6/site-packages/torch_cluster/graclus.py", line 5, in <module>
    import torch_cluster.graclus_cuda
ModuleNotFoundError: No module named 'torch_cluster.graclus_cuda'

How can I fix this?
Thanks in advance.

Error during installation

I am using python 3.6, Pytorch 1.0.

I am getting the following error when installing:

pip install torch-cluster
Collecting torch-cluster
  Using cached https://files.pythonhosted.org/packages/33/b7/05b9ce9afc76f5709efe04d6344fbed09ea217f916f94e63f2fe9659eb62/torch_cluster-1.2.2.tar.gz
Requirement already satisfied: scipy in /home/airscan-razer04/miniconda3/envs/pytorch/lib/python3.6/site-packages (from torch-cluster) (1.1.0)
Building wheels for collected packages: torch-cluster
  Running setup.py bdist_wheel for torch-cluster ... error
  Complete output from command /home/airscan-razer04/miniconda3/envs/pytorch/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_id9r1qr/torch-cluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-ij35ca3y --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/torch_cluster
  copying torch_cluster/__init__.py -> build/lib.linux-x86_64-3.6/torch_cluster
  copying torch_cluster/nearest.py -> build/lib.linux-x86_64-3.6/torch_cluster
  copying torch_cluster/fps.py -> build/lib.linux-x86_64-3.6/torch_cluster
  copying torch_cluster/knn.py -> build/lib.linux-x86_64-3.6/torch_cluster
  copying torch_cluster/graclus.py -> build/lib.linux-x86_64-3.6/torch_cluster
  copying torch_cluster/grid.py -> build/lib.linux-x86_64-3.6/torch_cluster
  copying torch_cluster/radius.py -> build/lib.linux-x86_64-3.6/torch_cluster
  creating build/lib.linux-x86_64-3.6/test
  copying test/test_radius.py -> build/lib.linux-x86_64-3.6/test
  copying test/__init__.py -> build/lib.linux-x86_64-3.6/test
  copying test/test_fps.py -> build/lib.linux-x86_64-3.6/test
  copying test/test_knn.py -> build/lib.linux-x86_64-3.6/test
  copying test/test_nearest.py -> build/lib.linux-x86_64-3.6/test
  copying test/test_graclus.py -> build/lib.linux-x86_64-3.6/test
  copying test/utils.py -> build/lib.linux-x86_64-3.6/test
  copying test/test_grid.py -> build/lib.linux-x86_64-3.6/test
  creating build/lib.linux-x86_64-3.6/torch_cluster/_ext
  copying torch_cluster/_ext/__init__.py -> build/lib.linux-x86_64-3.6/torch_cluster/_ext
  creating build/lib.linux-x86_64-3.6/torch_cluster/_ext/ffi
  copying torch_cluster/_ext/ffi/__init__.py -> build/lib.linux-x86_64-3.6/torch_cluster/_ext/ffi
  running build_ext
  building 'graclus_cpu' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/cpu
  gcc -pthread -B /home/airscan-razer04/miniconda3/envs/pytorch/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/airscan-razer04/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch/lib/include -I/home/airscan-razer04/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch/lib/include/TH -I/home/airscan-razer04/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch/lib/include/THC -I/home/airscan-razer04/miniconda3/envs/pytorch/include/python3.6m -c cpu/graclus.cpp -o build/temp.linux-x86_64-3.6/cpu/graclus.o -DTORCH_EXTENSION_NAME=graclus_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  cpu/graclus.cpp:1:29: fatal error: torch/extension.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for torch-cluster
  Running setup.py clean for torch-cluster
Failed to build torch-cluster
Installing collected packages: torch-cluster
  Running setup.py install for torch-cluster ... error
    Complete output from command /home/airscan-razer04/miniconda3/envs/pytorch/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_id9r1qr/torch-cluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-esqv00gn/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/torch_cluster
    copying torch_cluster/__init__.py -> build/lib.linux-x86_64-3.6/torch_cluster
    copying torch_cluster/nearest.py -> build/lib.linux-x86_64-3.6/torch_cluster
    copying torch_cluster/fps.py -> build/lib.linux-x86_64-3.6/torch_cluster
    copying torch_cluster/knn.py -> build/lib.linux-x86_64-3.6/torch_cluster
    copying torch_cluster/graclus.py -> build/lib.linux-x86_64-3.6/torch_cluster
    copying torch_cluster/grid.py -> build/lib.linux-x86_64-3.6/torch_cluster
    copying torch_cluster/radius.py -> build/lib.linux-x86_64-3.6/torch_cluster
    creating build/lib.linux-x86_64-3.6/test
    copying test/test_radius.py -> build/lib.linux-x86_64-3.6/test
    copying test/__init__.py -> build/lib.linux-x86_64-3.6/test
    copying test/test_fps.py -> build/lib.linux-x86_64-3.6/test
    copying test/test_knn.py -> build/lib.linux-x86_64-3.6/test
    copying test/test_nearest.py -> build/lib.linux-x86_64-3.6/test
    copying test/test_graclus.py -> build/lib.linux-x86_64-3.6/test
    copying test/utils.py -> build/lib.linux-x86_64-3.6/test
    copying test/test_grid.py -> build/lib.linux-x86_64-3.6/test
    creating build/lib.linux-x86_64-3.6/torch_cluster/_ext
    copying torch_cluster/_ext/__init__.py -> build/lib.linux-x86_64-3.6/torch_cluster/_ext
    creating build/lib.linux-x86_64-3.6/torch_cluster/_ext/ffi
    copying torch_cluster/_ext/ffi/__init__.py -> build/lib.linux-x86_64-3.6/torch_cluster/_ext/ffi
    running build_ext
    building 'graclus_cpu' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/cpu
    gcc -pthread -B /home/airscan-razer04/miniconda3/envs/pytorch/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/airscan-razer04/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch/lib/include -I/home/airscan-razer04/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch/lib/include/TH -I/home/airscan-razer04/miniconda3/envs/pytorch/lib/python3.6/site-packages/torch/lib/include/THC -I/home/airscan-razer04/miniconda3/envs/pytorch/include/python3.6m -c cpu/graclus.cpp -o build/temp.linux-x86_64-3.6/cpu/graclus.o -DTORCH_EXTENSION_NAME=graclus_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    cpu/graclus.cpp:1:29: fatal error: torch/extension.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/airscan-razer04/miniconda3/envs/pytorch/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_id9r1qr/torch-cluster/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-esqv00gn/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-_id9r1qr/torch-cluster/

I've already set the cuda/bin and cuda/include in PATH and CPATH.
I'm still trying to figure out if I'm just missing something.
Would appreciate your help on this.

Thanks.

Edit: Apparently, I wasn't using pytorch 1.0. Installation is good after updating pytorch to 1.0.

Code works on one GPU machine, doesn't work on another

Hello. my server has 4 GPUs. The default one is an RTX 2080. THe package can be installed and run fine on this GPU but when I run on other GPUs (TitanX), i got the following error

  File "/home/xxx/anaconda3/lib/python3.7/site-packages/torch_cluster/knn.py", line 123, in knn_graph
    row, col = knn(x, x, k if loop else k + 1, batch, batch, cosine=cosine)

  File "/home/xxx/anaconda3/lib/python3.7/site-packages/torch_cluster/knn.py", line 60, in knn
    return torch_cluster.knn_cuda.knn(x, y, k, batch_x, batch_y, cosine)

RuntimeError: CUDA error: no kernel image is available for execution on the device (launch_kernel at /opt/conda/conda-bld/pytorch_1573049306803/work/aten/src/ATen/native/cuda/Loops.cuh:102)

My guess is that setup.py automatically sets the flag for the RTX sm architecture. However, when I tried to add

extra_compile_args = {'gcc': [], 'nvcc': ['-arch=sm_30']}
if (TORCH_MAJOR > 1) or (TORCH_MAJOR == 1 and TORCH_MINOR > 2):
    extra_compile_args['gcc'] += ['-DVERSION_GE_1_3']

but when installing i got this error

Traceback (most recent call last):
  File "setup.py", line 77, in <module>
    packages=find_packages(),
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/xxx/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "/home/xxx/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/home/xxx/anaconda3/lib/python3.7/distutils/command/install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "/home/xxx/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 84, in run
    _build_ext.run(self)
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 353, in build_extensions
    build_ext.build_extensions(self)
  File "/home/xx/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions
    self.build_extension(ext)
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 205, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
    depends=ext.depends)
  File "/home/xxx/anaconda3/lib/python3.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/xxx/anaconda3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 271, in unix_wrap_compile
    cflags = cflags['cxx']
KeyError: 'cxx'

Please help!

getDefaultCPUGenerator

Hi,
I am getting the following error when I try to install pytorch_cluster. My pytorch version is 1.1.0.
Any idea about how to fix it?
Thanks

cpu/sampler.cpp: In function ‘at::Tensor neighbor_sampler(at::Tensor, at::Tensor, size_t, float)’:
cpu/sampler.cpp:6:45: error: ‘getDefaultCPUGenerator’ is not a member of ‘at::detail’
6 | at::CPUGenerator *generator = at::detail::getDefaultCPUGenerator();
| ^~~~~~~~~~~~~~~~~~~~~~
cpu/sampler.cpp:27:32: error: ‘struct at::CPUGenerator’ has no member named ‘random’
27 | int64_t z = generator->random() % num_neighbors;

Testing fails!

Hi there.

I have followed the installation steps. However, testing fails

root@Linux-HUETOS:~/Pytorch_Installation/pytorch_cluster# python3 setup.py test
Compiling kernel...
running pytest
running egg_info
writing top-level names to torch_cluster.egg-info/top_level.txt
writing dependency_links to torch_cluster.egg-info/dependency_links.txt
writing torch_cluster.egg-info/PKG-INFO
writing requirements to torch_cluster.egg-info/requires.txt
reading manifest file 'torch_cluster.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_cluster.egg-info/SOURCES.txt'
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.5/torch_cluster._ext.ffi._ffi.c'
creating build
creating build/temp.linux-x86_64-3.5
building 'torch_cluster._ext.ffi._ffi' extension
creating build/temp.linux-x86_64-3.5/build
creating build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/home
creating build/temp.linux-x86_64-3.5/home/eman
creating build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation
creating build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster
creating build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten
creating build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/TH
creating build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Iaten/TH -Iaten/THCC -I/usr/include/python3.5m -c build/temp.linux-x86_64-3.5/torch_cluster._ext.ffi._ffi.c -o build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/torch_cluster._ext.ffi._ffi.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Iaten/TH -Iaten/THCC -I/usr/include/python3.5m -c /home/eman/Pytorch_Installation/pytorch_cluster/aten/TH/THGraclus.c -o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/TH/THGraclus.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Iaten/TH -Iaten/THCC -I/usr/include/python3.5m -c /home/eman/Pytorch_Installation/pytorch_cluster/aten/TH/THGrid.c -o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/TH/THGrid.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Iaten/TH -Iaten/THCC -I/usr/include/python3.5m -c /home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGraclus.c -o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGraclus.o
/home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGraclus.c: In function ‘THCCTensor_graclus’:
/home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGraclus.c:10:3: warning: implicit declaration of function ‘THCTensor_graclus’ [-Wimplicit-function-declaration]
   THCTensor_graclus(state, self, row, col);
   ^
In file included from /usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCGeneral.h:4:0,
                 from /usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THC.h:4,
                 from /home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGraclus.c:1:
aten/THCC/generic/THCCGraclus.c: In function ‘THCCByteTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaByteTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
aten/THCC/generic/THCCGraclus.c: In function ‘THCCCharTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaCharTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
aten/THCC/generic/THCCGraclus.c: In function ‘THCCShortTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaShortTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
aten/THCC/generic/THCCGraclus.c: In function ‘THCCIntTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaIntTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
aten/THCC/generic/THCCGraclus.c: In function ‘THCCLongTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaLongTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
aten/THCC/generic/THCCGraclus.c: In function ‘THCCHalfTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaHalfTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
aten/THCC/generic/THCCGraclus.c: In function ‘THCCFloatTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
aten/THCC/generic/THCCGraclus.c: In function ‘THCCDoubleTensor_graclus’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaDoubleTensor_graclus’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGraclus.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(graclus)(state, self, row, col, weight);
   ^
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Iaten/TH -Iaten/THCC -I/usr/include/python3.5m -c /home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGrid.c -o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGrid.o
In file included from /usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCGeneral.h:4:0,
                 from /usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THC.h:4,
                 from /home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGrid.c:1:
aten/THCC/generic/THCCGrid.c: In function ‘THCCByteTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaByteTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
aten/THCC/generic/THCCGrid.c: In function ‘THCCCharTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaCharTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
aten/THCC/generic/THCCGrid.c: In function ‘THCCShortTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaShortTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
aten/THCC/generic/THCCGrid.c: In function ‘THCCIntTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaIntTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
aten/THCC/generic/THCCGrid.c: In function ‘THCCLongTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaLongTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
aten/THCC/generic/THCCGrid.c: In function ‘THCCHalfTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaHalfTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
aten/THCC/generic/THCCGrid.c: In function ‘THCCFloatTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
aten/THCC/generic/THCCGrid.c: In function ‘THCCDoubleTensor_grid’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:40: warning: implicit declaration of function ‘THCudaDoubleTensor_grid’ [-Wimplicit-function-declaration]
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                                        ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:118:37: note: in definition of macro ‘TH_CONCAT_4_EXPAND’
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC/THCTensor.h:9:28: note: in expansion of macro ‘TH_CONCAT_4’
 #define THCTensor_(NAME)   TH_CONCAT_4(TH,CReal,Tensor_,NAME)
                            ^
aten/THCC/generic/THCCGrid.c:7:3: note: in expansion of macro ‘THCTensor_’
   THCTensor_(grid)(state, self, pos, size, count);
   ^
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/torch_cluster
creating build/lib.linux-x86_64-3.5/torch_cluster/_ext
creating build/lib.linux-x86_64-3.5/torch_cluster/_ext/ffi
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/torch_cluster._ext.ffi._ffi.o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/TH/THGraclus.o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/TH/THGrid.o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGraclus.o build/temp.linux-x86_64-3.5/home/eman/Pytorch_Installation/pytorch_cluster/aten/THCC/THCCGrid.o torch_cluster/_ext/THC.so -o build/lib.linux-x86_64-3.5/torch_cluster/_ext/ffi/_ffi.abi3.so
copying build/lib.linux-x86_64-3.5/torch_cluster/_ext/ffi/_ffi.abi3.so -> torch_cluster/_ext/ffi
======================================== test session starts =========================================
platform linux -- Python 3.5.2, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/eman/Pytorch_Installation/pytorch_cluster, inifile: setup.cfg
plugins: cov-2.5.1
collected 0 items / 2 errors                                                                         

=============================================== ERRORS ===============================================
_______________________________ ERROR collecting test/test_graclus.py ________________________________
import file mismatch:
imported module 'test.test_graclus' has this __file__ attribute:
  /home/eman/rusty1s/pytorch_cluster/test/test_graclus.py
which is not the same as the test file we want to collect:
  /home/eman/Pytorch_Installation/pytorch_cluster/test/test_graclus.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
_________________________________ ERROR collecting test/test_grid.py _________________________________
import file mismatch:
imported module 'test.test_grid' has this __file__ attribute:
  /home/eman/rusty1s/pytorch_cluster/test/test_grid.py
which is not the same as the test file we want to collect:
  /home/eman/Pytorch_Installation/pytorch_cluster/test/test_grid.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

----------- coverage: platform linux, python 3.5.2-final-0 -----------
Name                                                                        Stmts   Miss  Cover
-----------------------------------------------------------------------------------------------
test/__init__.py                                                                0      0   100%
test/tensor.py                                                                  1      0   100%
torch_cluster/__init__.py                                                       4      0   100%
torch_cluster/_ext/__init__.py                                                  0      0   100%
torch_cluster/_ext/ffi/__init__.py                                             11      1    91%
torch_cluster/graclus.py                                                        9      6    33%
torch_cluster/grid.py                                                          12     10    17%
torch_cluster/utils/__init__.py                                                 0      0   100%
torch_cluster/utils/ffi.py                                                     11      7    36%
torch_cluster/utils/perm.py                                                    14     10    29%
/home/eman/rusty1s/pytorch_cluster/test/test_graclus.py                        29     18    38%
/home/eman/rusty1s/pytorch_cluster/test/test_grid.py                           18      9    50%
/usr/local/lib/python3.5/dist-packages/_pytest/_argcomplete.py                 35     34     3%
/usr/local/lib/python3.5/dist-packages/_pytest/_code/code.py                  583    562     4%
/usr/local/lib/python3.5/dist-packages/_pytest/assertion/__init__.py           66     62     6%
/usr/local/lib/python3.5/dist-packages/_pytest/assertion/rewrite.py           567    491    13%
/usr/local/lib/python3.5/dist-packages/_pytest/cacheprovider.py               182    145    20%
/usr/local/lib/python3.5/dist-packages/_pytest/capture.py                     402    377     6%
/usr/local/lib/python3.5/dist-packages/_pytest/compat.py                      141    135     4%
/usr/local/lib/python3.5/dist-packages/_pytest/config.py                      877    745    15%
/usr/local/lib/python3.5/dist-packages/_pytest/debugging.py                    92     82    11%
/usr/local/lib/python3.5/dist-packages/_pytest/doctest.py                     248    239     4%
/usr/local/lib/python3.5/dist-packages/_pytest/fixtures.py                    680    612    10%
/usr/local/lib/python3.5/dist-packages/_pytest/helpconfig.py                  107     98     8%
/usr/local/lib/python3.5/dist-packages/_pytest/junitxml.py                    285    283     1%
/usr/local/lib/python3.5/dist-packages/_pytest/logging.py                     255    224    12%
/usr/local/lib/python3.5/dist-packages/_pytest/main.py                        355    228    36%
/usr/local/lib/python3.5/dist-packages/_pytest/mark/__init__.py                74     55    26%
/usr/local/lib/python3.5/dist-packages/_pytest/mark/structures.py             192    158    18%
/usr/local/lib/python3.5/dist-packages/_pytest/monkeypatch.py                 127    115     9%
/usr/local/lib/python3.5/dist-packages/_pytest/nodes.py                       199    167    16%
/usr/local/lib/python3.5/dist-packages/_pytest/nose.py                         42     35    17%
/usr/local/lib/python3.5/dist-packages/_pytest/pastebin.py                     62     61     2%
/usr/local/lib/python3.5/dist-packages/_pytest/python.py                      738    712     4%
/usr/local/lib/python3.5/dist-packages/_pytest/resultlog.py                    87     85     2%
/usr/local/lib/python3.5/dist-packages/_pytest/runner.py                      319    275    14%
/usr/local/lib/python3.5/dist-packages/_pytest/setuponly.py                    47     46     2%
/usr/local/lib/python3.5/dist-packages/_pytest/setupplan.py                    13     12     8%
/usr/local/lib/python3.5/dist-packages/_pytest/skipping.py                    168    164     2%
/usr/local/lib/python3.5/dist-packages/_pytest/terminal.py                    538    425    21%
/usr/local/lib/python3.5/dist-packages/_pytest/tmpdir.py                       63     56    11%
/usr/local/lib/python3.5/dist-packages/attr/validators.py                      46     45     2%
/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py             1508   1506     1%
/usr/local/lib/python3.5/dist-packages/pluggy/__init__.py                     382    264    31%
/usr/local/lib/python3.5/dist-packages/pluggy/callers.py                      122     86    30%
/usr/local/lib/python3.5/dist-packages/py/_code/code.py                       524    522     1%
/usr/local/lib/python3.5/dist-packages/py/_error.py                            52     49     6%
/usr/local/lib/python3.5/dist-packages/py/_io/__init__.py                       0      0   100%
/usr/local/lib/python3.5/dist-packages/py/_io/terminalwriter.py               249    154    38%
/usr/local/lib/python3.5/dist-packages/py/_path/common.py                     274    179    35%
/usr/local/lib/python3.5/dist-packages/py/_path/local.py                      673    522    22%
/usr/local/lib/python3.5/dist-packages/py/_vendored_packages/apipkg.py        148    129    13%
/usr/local/lib/python3.5/dist-packages/py/_vendored_packages/iniconfig.py     122    121     1%
/usr/local/lib/python3.5/dist-packages/py/_xmlgen.py                          170    168     1%
/usr/local/lib/python3.5/dist-packages/pytest_cov/compat.py                    19     15    21%
/usr/local/lib/python3.5/dist-packages/pytest_cov/engine.py                   166    153     8%
/usr/local/lib/python3.5/dist-packages/pytest_cov/plugin.py                   157    144     8%
/usr/local/lib/python3.5/dist-packages/torch/cuda/__init__.py                 256    254     1%
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/__init__.py            110    108     2%
-----------------------------------------------------------------------------------------------
TOTAL                                                                       12631  11163    12%

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================== 2 error in 0.77 seconds =======================================

Inconsistent number of neighbors being returned from knn_graph

Version: 1.4.5

I'm getting an inconsistent number of nearest neighbours being returned from from knn_graph (cuda). I'll try to provide the actual data later. Currently I'm invoking the method as

edge_index = knn_graph(P, k=5, batch=batch, loop=False)

P is of dim [2048, 64], composed of a single batch
batch is a vector of zeros size 2048
The flow is set to its default value source_to_target.

edge_index is showing the following values

# everything fine with this one. 5 neighbours per point
(Pdb) edge_index[1,:16]
tensor([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3], device='cuda:0')
# at the end there are problems. indexes 2046 and 2047 are showing 6 times neighbours instead of 5
(Pdb) edge_index[1,-16:]
tensor([2045, 2045, 2045, 2045, 2046, 2046, 2046, 2046, 2046, 2046, 2047, 2047,
        2047, 2047, 2047, 2047], device='cuda:0')

torch-cluster installation fails on Windows 10 with Python 3.7, PyTorch 1.2, CUDA 10.0

Environment looks like so

$ pip list
decorator             4.4.0
googledrivedownloader 0.4
h5py                  2.9.0
isodate               0.6.0
joblib                0.13.2
networkx              2.3
numpy                 1.17.1
pandas                0.25.1
Pillow                6.1.0
pip                   19.2.3
plyfile               0.7
pyparsing             2.4.2
python-dateutil       2.8.0
pytz                  2019.2
rdflib                4.2.2
scikit-learn          0.21.3
scipy                 1.3.1
setuptools            41.2.0
six                   1.12.0
torch                 1.2.0
torch-geometric       1.3.1
torch-sparse          0.4.0
torchvision           0.4.0
wheel                 0.33.6
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:04_Central_Daylight_Time_2018
Cuda compilation tools, release 10.0, V10.0.130
$ python --version
Python 3.7.4
$ python -c "import torch; print(torch.version.cuda); print(torch.cuda.is_available()); print(torch.__version__)"
10.0
True
1.2.0
$ env | grep CUDA
CPATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
CUDA_PATH_V10_0=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
NVCUDASAMPLES10_0_ROOT=C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.0
NVCUDASAMPLES_ROOT=C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.0
PATH=/c/Users/ckamar/Developer/SimGNN/venv/Scripts:/c/tools/Cmder/vendor/conemu-maximus5/ConEmu/Scripts:/c/tools/Cmder/vendor/conemu-maximus5:/c/tools/Cmder/vendor/conemu-maximus5/ConEmu:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/libnvvp:...

It prints out a lot of warnings and ends up failing on this:

 graclus_kernel.cu
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1379): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1437): note: see reference to class template instantiation 'ska::flat_hash_map<K,V,H,E,A>' being compiled
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1383): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1391): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1473): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1510): note: see reference to class template instantiation 'ska::flat_hash_set<T,H,E,A>' being compiled
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1478): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1482): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1486): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    c:/users/ckamar/developer/simgnn/venv/lib/site-packages/torch/include\c10/util/flat_hash_map.h(1490): error C3203: 'templated_iterator': unspecialized class template can't be used as a template argument for template parameter '_Ty1', expected a real type
    error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.0\\bin\\nvcc.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\ckamar\developer\simgnn\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ckamar\\AppData\\Local\\Temp\\pip-install-6yaa4l2t\\torch-cluster\\setup.py'"'"'; __file__='"'"'C:\\Users\\ckamar\\AppData\\Local\\Temp\\pip-install-6yaa4l2t\\torch-cluster\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ckamar\AppData\Local\Temp\pip-record-9schp724\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\ckamar\developer\simgnn\venv\include\site\python3.7\torch-cluster'

Any help is appreciated. Thanks.

Questions about the knn_graph cosine distance calculation results

Hi, I got some trouble while using torch_clsuter.knn_graph.
When I run this code, it gives the following results.

import torch
from torch_cluster import knn_graph

x = torch.Tensor([[-1, -1], [-1, 1], [1, -1], [1, 1]]).cuda()
batch = torch.tensor([0, 0, 0, 0]).cuda()
edge_index = knn_graph(x, k=2, batch=batch, cosine=True)
print(edge_index)

>>>tensor([[1, 2, 0, 2, 0, 1, 0, 1, 2],
          [0, 0, 1, 1, 2, 2, 3, 3, 3]], device='cuda:0')

Shouldn't cosine <[-1, 1], [1, -1]> equal -1, and cosine <[-1, 1], [1, 1]> equal 0? Why the two nearset points to point 1 are 0, 2 instead of 0, 3.
Besides, why does point 3 have three nearest neighbors instead of two?

Versions:
python 3.7.4
pytorch 1.2.0
torch-cluster 1.4.5

Testing fails

Hi, first thanks for your work, it's useful for me.
I try to install this in my environment, but the test fails

[dcq@localhost pytorch_cluster]$ python -c "import torch; print(torch.__version__)"
0.4.1
[dcq@localhost pytorch_cluster]$ echo $PATH
/home/dcq/gcc-4.9.0/bin:/home/dcq/anaconda3/bin:/home/dcq/anaconda3/bin:/home/dcq/anaconda3/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/cuda-9.0/bin:/usr/local/cuda-9.0/bin:/home/dcq/.local/bin:/home/dcq/bin:/usr/local/cuda-9.0/bin:/usr/local/cuda-9.0/bin
[dcq@localhost pytorch_cluster]$ echo $CPATH
/usr/local/cuda-9.0/include
[dcq@localhost pytorch_cluster]$ 

The error message is as follows

[dcq@localhost pytorch_cluster]$ python setup.py test
running pytest
running egg_info
creating torch_cluster.egg-info
writing torch_cluster.egg-info/PKG-INFO
writing dependency_links to torch_cluster.egg-info/dependency_links.txt
writing top-level names to torch_cluster.egg-info/top_level.txt
writing manifest file 'torch_cluster.egg-info/SOURCES.txt'
reading manifest file 'torch_cluster.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_cluster.egg-info/SOURCES.txt'
running build_ext
building 'graclus_cpu' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cpu
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -m64 -fPIC -m64 -fPIC -fPIC -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/home/dcq/anaconda3/include/python3.7m -c cpu/graclus.cpp -o build/temp.linux-x86_64-3.7/cpu/graclus.o -DTORCH_EXTENSION_NAME=graclus_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/cast.h:16:0,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/attr.h:13,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:43,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5,
                 from cpu/graclus.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h: In function ‘pybind11::detail::internals& pybind11::detail::get_internals()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:33: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:53: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:9: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
         ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:61: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
                                                             ^
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5:0,
                 from cpu/graclus.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_acquire::gil_scoped_acquire()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:36: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:75: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                                                           ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:60: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
                                                            ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In member function ‘void pybind11::gil_scoped_acquire::dec_ref()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:13: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:69: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
                                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_release::gil_scoped_release(bool)’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:17: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:52: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In destructor ‘pybind11::gil_scoped_release::~gil_scoped_release()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:47: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
                                               ^
creating build/lib.linux-x86_64-3.7
g++ -pthread -shared -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.7/cpu/graclus.o -L/home/dcq/anaconda3/lib -lpython3.7m -o build/lib.linux-x86_64-3.7/graclus_cpu.cpython-37m-x86_64-linux-gnu.so
building 'grid_cpu' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -m64 -fPIC -m64 -fPIC -fPIC -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/home/dcq/anaconda3/include/python3.7m -c cpu/grid.cpp -o build/temp.linux-x86_64-3.7/cpu/grid.o -DTORCH_EXTENSION_NAME=grid_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/cast.h:16:0,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/attr.h:13,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:43,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5,
                 from cpu/grid.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h: In function ‘pybind11::detail::internals& pybind11::detail::get_internals()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:33: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:53: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:9: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
         ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:61: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
                                                             ^
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5:0,
                 from cpu/grid.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_acquire::gil_scoped_acquire()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:36: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:75: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                                                           ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:60: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
                                                            ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In member function ‘void pybind11::gil_scoped_acquire::dec_ref()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:13: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:69: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
                                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_release::gil_scoped_release(bool)’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:17: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:52: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In destructor ‘pybind11::gil_scoped_release::~gil_scoped_release()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:47: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
                                               ^
g++ -pthread -shared -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.7/cpu/grid.o -L/home/dcq/anaconda3/lib -lpython3.7m -o build/lib.linux-x86_64-3.7/grid_cpu.cpython-37m-x86_64-linux-gnu.so
building 'graclus_cuda' extension
creating build/temp.linux-x86_64-3.7/cuda
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -m64 -fPIC -m64 -fPIC -fPIC -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/dcq/anaconda3/include/python3.7m -c cuda/graclus.cpp -o build/temp.linux-x86_64-3.7/cuda/graclus.o -DTORCH_EXTENSION_NAME=graclus_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/cast.h:16:0,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/attr.h:13,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:43,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5,
                 from cuda/graclus.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h: In function ‘pybind11::detail::internals& pybind11::detail::get_internals()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:33: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:53: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:9: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
         ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:61: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
                                                             ^
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5:0,
                 from cuda/graclus.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_acquire::gil_scoped_acquire()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:36: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:75: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                                                           ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:60: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
                                                            ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In member function ‘void pybind11::gil_scoped_acquire::dec_ref()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:13: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:69: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
                                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_release::gil_scoped_release(bool)’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:17: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:52: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In destructor ‘pybind11::gil_scoped_release::~gil_scoped_release()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:47: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
                                               ^
/usr/local/cuda/bin/nvcc -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/dcq/anaconda3/include/python3.7m -c cuda/graclus_kernel.cu -o build/temp.linux-x86_64-3.7/cuda/graclus_kernel.o -DTORCH_EXTENSION_NAME=graclus_cuda -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options '-fPIC' -std=c++11
g++ -pthread -shared -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.7/cuda/graclus.o build/temp.linux-x86_64-3.7/cuda/graclus_kernel.o -L/usr/local/cuda/lib64 -L/home/dcq/anaconda3/lib -lcudart -lpython3.7m -o build/lib.linux-x86_64-3.7/graclus_cuda.cpython-37m-x86_64-linux-gnu.so
building 'grid_cuda' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -m64 -fPIC -m64 -fPIC -fPIC -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/dcq/anaconda3/include/python3.7m -c cuda/grid.cpp -o build/temp.linux-x86_64-3.7/cuda/grid.o -DTORCH_EXTENSION_NAME=grid_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/cast.h:16:0,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/attr.h:13,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:43,
                 from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5,
                 from cuda/grid.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:14: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
              ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
                                  ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h: In function ‘pybind11::detail::internals& pybind11::detail::get_internals()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:33: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:169:53: warning: ‘int PyThread_create_key()’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:95) [-Wdeprecated-declarations]
         internals_ptr->tstate = PyThread_create_key();
                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:9: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
         ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/detail/internals.h:170:61: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
         PyThread_set_key_value(internals_ptr->tstate, tstate);
                                                             ^
In file included from /home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/torch.h:5:0,
                 from cuda/grid.cpp:1:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_acquire::gil_scoped_acquire()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:36: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1758:75: warning: ‘void* PyThread_get_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:98) [-Wdeprecated-declarations]
         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
                                                                           ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1770:60: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(internals.tstate, tstate);
                                                            ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In member function ‘void pybind11::gil_scoped_acquire::dec_ref()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:13: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1809:69: warning: ‘void PyThread_delete_key_value(int)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:99) [-Wdeprecated-declarations]
             PyThread_delete_key_value(detail::get_internals().tstate);
                                                                     ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_release::gil_scoped_release(bool)’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:17: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                 ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1837:52: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
                 PyThread_set_key_value(key, nullptr);
                                                    ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h: In destructor ‘pybind11::gil_scoped_release::~gil_scoped_release()’:
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:13: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
             ^
/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1850:47: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated (declared at /home/dcq/anaconda3/include/python3.7m/pythread.h:97) [-Wdeprecated-declarations]
             PyThread_set_key_value(key, tstate);
                                               ^
/usr/local/cuda/bin/nvcc -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/dcq/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/dcq/anaconda3/include/python3.7m -c cuda/grid_kernel.cu -o build/temp.linux-x86_64-3.7/cuda/grid_kernel.o -DTORCH_EXTENSION_NAME=grid_cuda -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options '-fPIC' -std=c++11
g++ -pthread -shared -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed -L/home/dcq/anaconda3/lib -Wl,-rpath=/home/dcq/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.7/cuda/grid.o build/temp.linux-x86_64-3.7/cuda/grid_kernel.o -L/usr/local/cuda/lib64 -L/home/dcq/anaconda3/lib -lcudart -lpython3.7m -o build/lib.linux-x86_64-3.7/grid_cuda.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/graclus_cpu.cpython-37m-x86_64-linux-gnu.so -> 
copying build/lib.linux-x86_64-3.7/grid_cpu.cpython-37m-x86_64-linux-gnu.so -> 
copying build/lib.linux-x86_64-3.7/graclus_cuda.cpython-37m-x86_64-linux-gnu.so -> 
copying build/lib.linux-x86_64-3.7/grid_cuda.cpython-37m-x86_64-linux-gnu.so -> 
====================================================== test session starts =======================================================
platform linux -- Python 3.7.0, pytest-3.10.0, py-1.6.0, pluggy-0.7.1
rootdir: /home/dcq/pypi-package/pytorch_cluster, inifile: setup.cfg
plugins: remotedata-0.3.0, openfiles-0.3.0, doctestplus-0.1.3, cov-2.6.0, arraydiff-0.2
collected 84 items                                                                                                               

test/test_graclus.py Segmentation fault (core dumped)

Random Walk not working

First, some info:
pip freeze gives

absl-py==0.9.0
azure-common==1.1.24
azure-nspkg==3.0.2
azure-storage==0.36.0
beautifulsoup4==4.8.2
cachetools==4.0.0
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
cryptography==2.8
cycler==0.10.0
decorator==4.4.1
docopt==0.6.2
dpu-utils==0.2.8
google==2.0.3
google-auth==1.11.2
google-auth-oauthlib==0.4.1
googledrivedownloader==0.4
grpcio==1.27.2
h5py==2.10.0
idna==2.8
imageio==2.6.1
isodate==0.6.0
joblib==0.14.1
kiwisolver==1.1.0
llvmlite==0.31.0
Markdown==3.2.1
matplotlib==3.1.3
more-itertools==8.2.0
networkx==2.4
numba==0.48.0
numpy==1.18.1
oauthlib==3.1.0
opt-einsum==3.1.0
overrides==2.8.0
pandas==1.0.1
Pillow==7.0.0
plyfile==0.7.1
protobuf==3.11.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.19
pyparsing==2.4.6
pyro-api==0.1.1
pyro-ppl==1.2.1
python-dateutil==2.8.1
pytz==2019.3
PyWavelets==1.1.1
rdflib==4.2.2
requests==2.22.0
requests-oauthlib==1.3.0
rsa==4.0
scikit-image==0.16.2
scikit-learn==0.22.1
scipy==1.4.1
seaborn==0.10.0
sentencepiece==0.1.85
SetSimilaritySearch==0.1.7
six==1.14.0
soupsieve==1.9.5
tensorboard==2.1.0
torch==1.4.0
torch-cluster==1.4.5
torch-geometric==1.4.1
torch-scatter==2.0.3
torch-sparse==0.5.1
tqdm==4.42.1
urllib3==1.25.8
Werkzeug==1.0.0

echo $PATH:
/home/dobrik/anaconda3/envs/geometric_new/bin:/usr/local/cuda-10.1/bin:/home/dobrik/anaconda3/bin:/home/dobrik/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

echo $CPATH:
/usr/local/cuda-10.1/include:

Tests are also passing:

========================================== test session starts ==========================================
platform linux -- Python 3.8.1, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/dobrik/anaconda3/envs/geometric_new/lib/python3.8/site-packages/torch_cluster/pytorch_cluster, inifile: setup.cfg
plugins: cov-2.8.1
collected 77 items                                                                                      

test/test_fps.py ......
test/test_graclus.py ................
test/test_grid.py ................................
test/test_knn.py ........
test/test_nearest.py ....
test/test_radius.py ........
test/test_rw.py ..
test/test_sampler.py .

----------- coverage: platform linux, python 3.8.1-final-0 -----------
Name                        Stmts   Miss  Cover
-----------------------------------------------
torch_cluster/__init__.py      15      0   100%
torch_cluster/fps.py            2      0   100%
torch_cluster/graclus.py        2      0   100%
torch_cluster/grid.py           2      0   100%
torch_cluster/knn.py           40      0   100%
torch_cluster/nearest.py       23      0   100%
torch_cluster/radius.py        32      0   100%
torch_cluster/rw.py             3      0   100%
torch_cluster/sampler.py        1      0   100%
-----------------------------------------------
TOTAL                         120      0   100%


========================================== 77 passed in 3.12s ===========================================

However, the random walk does not 'respect' the adjacency matrix. A minimal example with a small bipartite undirected graph follows. I'm running the script on CPU, no CUDA involved (for now):

>>> rows
tensor([0, 1, 2, 1, 3, 4, 1, 2, 3, 3, 5, 5])
>>> cols
tensor([1, 2, 3, 3, 5, 5, 0, 1, 2, 1, 3, 4])
>>> torch_cluster.random_walk(rows, cols, torch.tensor(0), walk_length=3)
tensor([[0, 1, 3, 2]])
>>> torch_cluster.random_walk(rows, cols, torch.tensor(0), walk_length=3)
tensor([[0, 1, 3, 2]])
>>> torch_cluster.random_walk(rows, cols, torch.tensor(0), walk_length=3)
tensor([[0, 1, 2, 5]])
>>> torch_cluster.random_walk(rows, cols, torch.tensor(0), walk_length=3)
tensor([[0, 1, 3, 0]])

The last random walk is not valid. there is no edge between 3 and 0.

Am I misusing the API, by any chance?

Segmentation fault (core dumped)

When I run python reddit.py in pytorch_geometric, which use neighbor_sampler in torch_cluster, it occur 'Segmentation fault (core dumped)'. My machine is Ubuntu 16.04.5, use python3.6 and cuda10.0

Data on different GPUs

Graclus throws error if the GPU the model is on was specified by the user via ".cuda(GPU)".

I get the following error message:

Traceback (most recent call last):
File "one_to_three_graclus.py", line 259, in
b_3))
File "one_to_three_graclus.py", line 128, in train
output = model(t_1, f_1, t_2, f_2, ntt_2, t_3, f_3, ntt_3, b_1, b_2, b_3)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call
result = self.forward(*input, **kwargs)
File "one_to_three_graclus.py", line 103, in forward
l_3, x_3, adj_3, b_3 = graclus_pool_test(l_3, x_3, adj_3, b_3)
File "../torch_geometric/nn/functional/pool/graclus.py", line 31, in graclus_pool_test
cluster = graclus_cluster(row, col, weight, adj.size(0))
File "/usr/local/lib/python3.5/dist-packages/torch_cluster/graclus.py", line 33, in graclus_cluster
graclus(cluster, row, col, weight)
File "/usr/local/lib/python3.5/dist-packages/torch_cluster/utils/ffi.py", line 12, in graclus
func(self, row, col) if weight is None else func(self, row, col, weight)
File "/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/init.py", line 180, in safe_call
result = torch._C._safe_call(*args, **kwargs)
torch.FatalError: arguments are located on different GPUs at aten/THC/THCGraclus.cu:31

Latest binaries not found in link

Looks like the site doesn't have a link for the torch_cluster binaries. So the following instruction from the REAME is failing:

pip install torch-cluster==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html

installation gcc errors

I'm getting some GCC errors when I try to install. The full output is here. I have the PATH and CPATH environment variables set per the README installation instructions. I'm installing in a conda environment, which I suspect may be complicating things, but I'm at a bit of a loss as to how to proceed resolving the issue. I'd be grateful for any suggestions and glad to provide any additional details.

Expected object of scalar type Long but got scalar type Int for sequence elment 1 in sequence argument at position #1 'tensors'

Hello, I was trying to run one of your examples in the documentation and found this.

import torch
from torch_cluster import knn_graph

x = torch.tensor([[-1, -1], [-1, 1], [1, -1], [1, 1]])
edge_index = knn_graph(x, k=2, loop=False)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-58-47d38d59d882> in <module>
      3 
      4 x = torch.tensor([[-1, -1], [-1, 1], [1, -1], [1, 1]])
----> 5 edge_index = knn_graph(x, k=2, loop=False)

~\Anaconda3\lib\site-packages\torch_cluster\knn.py in knn_graph(x, k, batch, loop)
    105     """
    106 
--> 107     edge_index = knn(x, x, k if loop else k + 1, batch, batch)
    108     if not loop:
    109         row, col = edge_index

~\Anaconda3\lib\site-packages\torch_cluster\knn.py in knn(x, y, k, batch_x, batch_y)
     75     row, col = row.view(-1)[mask], col.view(-1)[mask]
     76 
---> 77     return torch.stack([row, col], dim=0)
     78 
     79 

RuntimeError: Expected object of scalar type Long but got scalar type Int for sequence elment 1 in sequence argument at position #1 'tensors'

The results of graclus_cluster

I've tested graclus_cluster on random graphs(density=0.2) with size varing from 10 ~ 4000. In all cases, graclus_cluster obtains many tiny clusters which usually have only 2 nodes. I am not sure if this phenomenon is normal. The figure below demonstrates what I said.
newplot (6)

graclus result in readme

import torch
from torch_cluster import graclus_cluster

row = torch.tensor([0, 1, 1, 2])
col = torch.tensor([1, 0, 2, 1])
weight = torch.Tensor([1, 1, 1, 1]) # Optional edge weights.

cluster = graclus_cluster(row, col, weight)
print(cluster)
tensor([0, 0, 1])

The result seems to be 'tensor([0, 0, 2])' in my mac

can I install this without CUDA?

I want to install it in my MacBook with MacOS 10.13, Radeon Pro 560 4 GB, Intel HD Graphics 630 1536 MB. My MacBook doesn't have CUDA. Can I install this library?

Buffer overflow in cpu/rw.cpp

      cur = col_d[cum_deg_d[cur] +
                  int64_t(rand_d[n * walk_length + (l - 1)] * deg_d[cur])];

If deg_d[cur] is 0, this will give the wrong result. (It will follow an edge that belongs to another node.) If additionally this is the last vertex, it will overflow col_d. If walk_length is 1, it will just give you walks with very high vertex IDs. With longer walks it will segfault.

>>> torch_cluster.rw_cpu.rw(torch.tensor([0, 0, 2, 1]), torch.tensor([1, 2, 3, 3]), torch.tensor([0, 1, 2, 3]), 1, 1, 1, 4) 
tensor([[              0,               1],
        [              1,               3],
        [              2,               3],
        [              3, 140686418058400]])

The CUDA implementation is different, but I think it also generates incorrect walks:

      out[l * numel + n] = col[row[cur] + int64_t(rand[i] * deg[cur])];

How is the algorithm supposed to handle nodes with no outgoing edges? Producing shorter walks when we hit such a node is probably out of the question. Maybe we could just keep repeating the same node then? That would be easy to implement at least.

classical K-Means clustering

The classical K-Means clustering has been also widely used in many papers, including graph-based repreentation learning. Could you consider implementing it as a new feature?

voxel_grid enhancement -> Re-indexation from 0

Hey @rusty1s,

I am using voxel_grid, and on my 8000 point cloud, it creates a 5001 indexes with the highest being around 400k.

As a result, the pool_pos used to make the aggregation create a massive tensor, which isn't great for memory reduction.

The new features will add reindex=True, return new batch and reindexed indices from 0 to N.

Best.
Thomas Chaton.

[BUG] Inconsistent behavior of 'neighbor_sampler' when setting a random seed for PyTorch

When testing with the following codes

torch.manual_seed(1234)
start = torch.tensor([0, 1])
cumdeg = torch.tensor([0, 3, 7])
neighbor_sampler(start, cumdeg, size=2)

we cannot get consistent bebaviors with multiple runs as expected in test_sampler.py.

The reason for such inconsistence is that the sampling code in cpu has two sampling branches:

if (size < 0.7 * float(num_neighbors)) {
      ......
      int64_t sample = rand() % num_neighbors;
      ......
    } else {
      auto sample = torch::randperm(num_neighbors, start.options());
      ......
}

The upper branch utilizes the rand function provided by C++, which causes this inconsistence.

Maybe we should leverage similar functions provided by PyTorch, which can be controlled by 'torch.manual_seed()'?

cpu/sampler.cpp:6:45: error: no member named 'getDefaultCPUGenerator' in namespace 'at::detail'

Hey I'm trying to install this package on MacOS.

I tried pip install torch-cluster but I get 'gcc' failed with exit status 1. I had the same issues when installing torch-scatter and torch-sparse but using the fix given here allowed me to install those packages. The same fix doesn't seem to be working here and I'm unsure how to resolve the issue!

The command python -c "import torch; print(torch.__version__)" outputs 1.1.0 so it seems my PyTorch is up to date.

The stacktrace is given below.

kenlay@Henry-2:~/pytorch_cluster$ MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
running install
running bdist_egg
running egg_info
writing torch_cluster.egg-info/PKG-INFO
writing dependency_links to torch_cluster.egg-info/dependency_links.txt
writing requirements to torch_cluster.egg-info/requires.txt
writing top-level names to torch_cluster.egg-info/top_level.txt
reading manifest file 'torch_cluster.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'torch_cluster.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-x86_64/egg
running install_lib
running build_py
running build_ext
building 'torch_cluster.sampler_cpu' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/lib/python3.7/site-packages/torch/include -I/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/anaconda3/lib/python3.7/site-packages/torch/include/TH -I/anaconda3/lib/python3.7/site-packages/torch/include/THC -I/anaconda3/include/python3.7m -c cpu/sampler.cpp -o build/temp.macosx-10.7-x86_64-3.7/cpu/sampler.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=sampler_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cpu/sampler.cpp:6:45: error: no member named 'getDefaultCPUGenerator' in namespace 'at::detail'
at::CPUGenerator *generator = at::detail::getDefaultCPUGenerator();
~~~~~~~~~~~~^
1 error generated.
error: command 'clang' failed with exit status 1

Thanks

Batched knn_graph

I don't quite understand the documentation for knn or knn_graph functions.
Can these functions be used for batched computation, i.e. finding nearest neighbors between a
BxMxD and BxNxD tensor or constructing a knn_graph in a BxNxD tensor? If so, how?

Thanks in advance!

What does the output of `grid_cluster` represent?

Hey Matthias,

I'm trying to get some additional insight into what the grid_cluster function outputs. The readme links to a reference paper in which the authors mention they used a voxel grid filter from PCL. That filter generates a filtered copy of the input data. On the other hand, grid_cluster appears to be output indices but it there's no way of knowing the voxel centers used for clustering.

At some point I also considered that these might be indexes from the original input data, but the example in the readme contradicts that.

import torch
from torch_cluster import grid_cluster

pos = torch.Tensor([[0, 0], [11, 9], [2, 8], [2, 2], [8, 3]])
size = torch.Tensor([5, 5])

cluster = grid_cluster(pos, size)
>>> print(cluster)
tensor([0, 5, 3, 0, 1])

Index 5 is too large for an input of size 5.

So my question is, what does the output of grid_cluster represent?

Cannot import pytorch cluster

okayi have tried installing the by : CFLAGS='-stdlib=libc++’ pip install --verbose --no-cache-dir torch-cluster

this made it install, but fails while importing torch_cluster
it throws: Symbol not found: __ZN6caffe26detail36_typeMetaDataInstance_preallocated_0E

fps seems broken

import torch
from torch_geometric.nn import fps
import unittest


class TestGridSampling(unittest.TestCase):

    def test_simple(self):

        num_points = 2048
        pos = torch.randn((num_points, 3)).cuda()
        batch = torch.zeros((num_points)).cuda().long()
        idx = fps(pos, batch, 0.25)
        print(idx)

if __name__ == "__main__":
    unittest.main()

tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0], device='cuda:0')

undefined symbol: _ZN3c106Device8validateEv

Hi!
I want to install the lastest version of pyg.
After I installed the pytorch-cluster module, I want to verify whether it's correct to install.
But, I have got a error which was shown as follow:

ImportError while importing test module '/home/amax/Downloads/0621/pytorch_cluster-master/test/test_sampler.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: test/test_sampler.py:3: in <module> from torch_cluster import neighbor_sampler torch_cluster/__init__.py:1: in <module> from .graclus import graclus_cluster torch_cluster/graclus.py:2: in <module> import torch_cluster.graclus_cpu E ImportError: /home/amax/Downloads/0621/pytorch_cluster-master/torch_cluster/graclus_cpu.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c106Device8validateEv

I have tried to solve this problem, but I failed!
Can you help me to deal with it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.