Skip to content

Commit 969eac9

Browse files
Cleanup
2 parents a18bff0 + 06acee8 commit 969eac9

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ import torch
1717
import torch_points.points_cuda
1818
```
1919

20+
## Build and test
21+
```
22+
python setup.py build_ext --inplace
23+
python -m unittest
24+
```
25+
2026
## Projects using those kernels.
2127

2228
[```Pytorch Point Cloud Benchmark```](https://github.com/nicolas-chaulet/deeppointcloud-benchmarks) by

test/test_ballquerry.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def test_simple_cpu(self):
2020
def test_cpu_gpu_equality(self):
2121
a = torch.randn(5, 1000, 3)
2222
npt.assert_array_equal(ball_query_dense(0.1, 17, a, a).detach().numpy(),
23-
ball_query_dense(0.1, 17, a.cuda(), a.cuda()).detach().numpy())
24-
25-
23+
ball_query_dense(0.1, 17, a.cuda(), a.cuda()).cpu().detach().numpy())
2624

2725

2826
if __name__ == "__main__":

test/test_grouping.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy.testing as npt
55
from torch_points import grouping_operation
66

7+
78
class TestGroup(unittest.TestCase):
89

910
# input: points(b, c, n) idx(b, npoints, nsample)
@@ -12,29 +13,29 @@ def test_simple(self):
1213
features = torch.tensor([
1314
[[0, 10, 0], [1, 11, 0], [2, 12, 0]],
1415
[
15-
[100, 110, 120], # x-coordinates
16-
[101, 111, 121], # y-coordinates
17-
[102, 112, 122], # z-coordinates
16+
[100, 110, 120], # x-coordinates
17+
[101, 111, 121], # y-coordinates
18+
[102, 112, 122], # z-coordinates
1819
]
19-
])
20+
]).type(torch.float)
2021
idx = torch.tensor([
2122
[[1, 0], [0, 0]],
2223
[[0, 1], [1, 2]]
23-
])
24+
]).type(torch.int)
2425

2526
expected = np.array([
2627
[
27-
[[10, 0], [0, 0]],
28-
[[11, 1], [1, 1]],
28+
[[10, 0], [0, 0]],
29+
[[11, 1], [1, 1]],
2930
[[12, 2], [2, 2]]
3031
],
31-
[ # 2nd batch
32-
[ # x-coordinates
33-
[100, 110], #x-coordinates of samples for point 0
34-
[110, 120], #x-coordinates of samples for point 1
35-
],
36-
[[101, 111], [111, 121]], # y-coordinates
37-
[[102, 112], [112, 122]], # z-coordinates
32+
[ # 2nd batch
33+
[ # x-coordinates
34+
[100, 110], # x-coordinates of samples for point 0
35+
[110, 120], # x-coordinates of samples for point 1
36+
],
37+
[[101, 111], [111, 121]], # y-coordinates
38+
[[102, 112], [112, 122]], # z-coordinates
3839
]
3940
])
4041

@@ -45,10 +46,10 @@ def test_simple(self):
4546
if torch.cuda.is_available():
4647
npt.assert_array_equal(
4748
grouping_operation(
48-
features.cuda(),
49+
features.cuda(),
4950
idx.cuda()
50-
).detach().cpu().numpy(), expected)
51+
).detach().cpu().numpy(), expected)
5152

5253

5354
if __name__ == '__main__':
54-
unittest.main()
55+
unittest.main()

torch_points/torchpoints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ def gather_operation(features, idx):
7777
(B, C, N) tensor
7878
7979
idx : torch.Tensor
80-
(B, npoint, nsample) tensor of the features to gather
80+
(B, npoint) tensor of the features to gather
8181
8282
Returns
8383
-------
8484
torch.Tensor
85-
(B, C, npoint, nsample) tensor
85+
(B, C, npoint) tensor
8686
"""
8787
return GatherOperation.apply(features, idx)
8888

0 commit comments

Comments
 (0)