Skip to content

Commit 75a3899

Browse files
committed
year up, restricted coverage, nested extensions
1 parent da8f675 commit 75a3899

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[run]
2+
source=torch_sparse
13
[report]
24
exclude_lines =
35
pragma: no cover

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018 Matthias Fey <[email protected]>
1+
Copyright (c) 2019 Matthias Fey <[email protected]>
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

cuda/spspmm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <torch/torch.h>
1+
#include <torch/extension.h>
22

33
#define CHECK_CUDA(x) AT_ASSERTM(x.type().is_cuda(), #x " must be CUDA tensor")
44

cuda/unique.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <torch/torch.h>
1+
#include <torch/extension.h>
22

33
#define CHECK_CUDA(x) AT_ASSERTM(x.type().is_cuda(), #x " must be CUDA tensor")
44

setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,25 @@
1313

1414
if CUDA_HOME is not None:
1515
if platform.system() == 'Windows':
16-
extra_link_args = 'cusparse.lib'
16+
extra_link_args = ['cusparse.lib']
1717
else:
1818
extra_link_args = ['-lcusparse', '-l', 'cusparse']
1919

2020
ext_modules += [
2121
CUDAExtension(
22-
'spspmm_cuda', ['cuda/spspmm.cpp', 'cuda/spspmm_kernel.cu'],
22+
'torch_sparse.spspmm_cuda',
23+
['cuda/spspmm.cpp', 'cuda/spspmm_kernel.cu'],
2324
extra_link_args=extra_link_args),
24-
CUDAExtension('unique_cuda',
25+
CUDAExtension('torch_sparse.unique_cuda',
2526
['cuda/unique.cpp', 'cuda/unique_kernel.cu']),
2627
]
2728
cmdclass['build_ext'] = BuildExtension
2829

2930
setup(
3031
name='torch_sparse',
3132
version=__version__,
32-
description='PyTorch Extension Library of Optimized Autograd Sparse '
33-
'Matrix Operations',
33+
description=('PyTorch Extension Library of Optimized Autograd Sparse '
34+
'Matrix Operations'),
3435
author='Matthias Fey',
3536
author_email='[email protected]',
3637
url=url,
@@ -41,4 +42,5 @@
4142
tests_require=tests_require,
4243
ext_modules=ext_modules,
4344
cmdclass=cmdclass,
44-
packages=find_packages(), )
45+
packages=find_packages(),
46+
)

torch_sparse/spspmm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from torch_sparse import transpose
55

66
if torch.cuda.is_available():
7-
import spspmm_cuda
7+
import torch_sparse.spspmm_cuda
88

99

1010
def spspmm(indexA, valueA, indexB, valueB, m, k, n):
@@ -60,7 +60,8 @@ def mm(indexA, valueA, indexB, valueB, m, k, n):
6060
assert valueA.dtype == valueB.dtype
6161

6262
if indexA.is_cuda:
63-
return spspmm_cuda.spspmm(indexA, valueA, indexB, valueB, m, k, n)
63+
return torch_sparse.spspmm_cuda.spspmm(indexA, valueA, indexB, valueB,
64+
m, k, n)
6465

6566
A = to_scipy(indexA, valueA, m, k)
6667
B = to_scipy(indexB, valueB, k, n)

torch_sparse/utils/unique.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import numpy as np
33

44
if torch.cuda.is_available():
5-
import unique_cuda
5+
import torch_sparse.unique_cuda
66

77

88
def unique(src):
99
src = src.contiguous().view(-1)
1010

1111
if src.is_cuda:
12-
out, perm = unique_cuda.unique(src)
12+
out, perm = torch_sparse.unique_cuda.unique(src)
1313
else:
1414
out, perm = np.unique(src.numpy(), return_index=True)
1515
out, perm = torch.from_numpy(out), torch.from_numpy(perm)

0 commit comments

Comments
 (0)