@@ -39,17 +39,16 @@ A greedy clustering algorithm of picking an unmarked vertex and matching it with
3939import torch
4040from torch_cluster import graclus_cluster
4141
42- row = torch.LongTensor ([0 , 1 , 1 , 2 ])
43- col = torch.LongTensor ([1 , 0 , 2 , 1 ])
44- weight = torch.Tensor ([1 , 1 , 1 , 1 ]) # Optional edge weights.
42+ row = torch.tensor ([0 , 1 , 1 , 2 ])
43+ col = torch.tensor ([1 , 0 , 2 , 1 ])
44+ weight = torch.tensor ([1 , 1 , 1 , 1 ]) # Optional edge weights.
4545
4646cluster = graclus_cluster(row, col, weight)
4747```
4848
4949```
5050print(cluster)
51- 0 0 1
52- [torch.LongTensor of size 3]
51+ tensor([ 0, 0, 1])
5352```
5453
5554## VoxelGrid
@@ -60,16 +59,15 @@ A clustering algorithm, which overlays a regular grid of user-defined size over
6059import torch
6160from torch_cluster import grid_cluster
6261
63- pos = torch.Tensor ([[0 , 0 ], [11 , 9 ], [2 , 8 ], [2 , 2 ], [8 , 3 ]])
64- size = torch.Tensor ([5 , 5 ])
62+ pos = torch.tensor ([[0 , 0 ], [11 , 9 ], [2 , 8 ], [2 , 2 ], [8 , 3 ]])
63+ size = torch.tensor ([5 , 5 ])
6564
6665cluster = grid_cluster(pos, size)
6766```
6867
6968```
7069print(cluster)
71- 0 5 3 0 1
72- [torch.LongTensor of size 5]
70+ tensor([ 0, 5, 3, 0, 1])
7371```
7472
7573## Running tests
0 commit comments