@@ -107,7 +107,7 @@ from torch_cluster import graclus_cluster
107107
108108row = torch.tensor([0 , 1 , 1 , 2 ])
109109col = torch.tensor([1 , 0 , 2 , 1 ])
110- weight = torch.Tensor ([1 , 1 , 1 , 1 ]) # Optional edge weights.
110+ weight = torch.tensor ([1 . , 1 . , 1 . , 1 . ]) # Optional edge weights.
111111
112112cluster = graclus_cluster(row, col, weight)
113113```
@@ -125,7 +125,7 @@ A clustering algorithm, which overlays a regular grid of user-defined size over
125125import torch
126126from torch_cluster import grid_cluster
127127
128- pos = torch.Tensor ([[0 , 0 ], [11 , 9 ], [2 , 8 ], [2 , 2 ], [8 , 3 ]])
128+ pos = torch.tensor ([[0 . , 0 . ], [11 . , 9 . ], [2 . , 8 . ], [2 . , 2 . ], [8 . , 3 . ]])
129129size = torch.Tensor([5 , 5 ])
130130
131131cluster = grid_cluster(pos, size)
@@ -144,7 +144,7 @@ A sampling algorithm, which iteratively samples the most distant point with rega
144144import torch
145145from torch_cluster import fps
146146
147- x = torch.Tensor ([[- 1 , - 1 ], [- 1 , 1 ], [1 , - 1 ], [1 , 1 ]])
147+ x = torch.tensor ([[- 1 . , - 1 . ], [- 1 . , 1 . ], [1 . , - 1 . ], [1 . , 1 . ]])
148148batch = torch.tensor([0 , 0 , 0 , 0 ])
149149index = fps(x, batch, ratio = 0.5 , random_start = False )
150150```
@@ -162,7 +162,7 @@ Computes graph edges to the nearest *k* points.
162162import torch
163163from torch_cluster import knn_graph
164164
165- x = torch.Tensor ([[- 1 , - 1 ], [- 1 , 1 ], [1 , - 1 ], [1 , 1 ]])
165+ x = torch.tensor ([[- 1 . , - 1 . ], [- 1 . , 1 . ], [1 . , - 1 . ], [1 . , 1 . ]])
166166batch = torch.tensor([0 , 0 , 0 , 0 ])
167167edge_index = knn_graph(x, k = 2 , batch = batch, loop = False )
168168```
@@ -181,7 +181,7 @@ Computes graph edges to all points within a given distance.
181181import torch
182182from torch_cluster import radius_graph
183183
184- x = torch.Tensor ([[- 1 , - 1 ], [- 1 , 1 ], [1 , - 1 ], [1 , 1 ]])
184+ x = torch.tensor ([[- 1 . , - 1 . ], [- 1 . , 1 . ], [1 . , - 1 . ], [1 . , 1 . ]])
185185batch = torch.tensor([0 , 0 , 0 , 0 ])
186186edge_index = radius_graph(x, r = 1.5 , batch = batch, loop = False )
187187```
0 commit comments