Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-cluster
Commits
4576030c
Commit
4576030c
authored
Apr 07, 2018
by
rusty1s
Browse files
first new grid impl
parent
7d1dde9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
torch_cluster/grid.py
torch_cluster/grid.py
+13
-2
No files found.
torch_cluster/grid.py
View file @
4576030c
from
.utils.ffi
import
grid
def
grid_cluster
(
pos
,
size
,
batch
=
None
,
start
=
None
,
end
=
None
):
def
grid_cluster
(
pos
,
size
,
start
=
None
,
end
=
None
):
pos
=
pos
.
unsqueeze
(
-
1
)
if
pos
.
dim
()
==
1
else
pos
grid
(
None
,
None
,
None
,
None
)
start
=
pos
.
t
().
min
(
dim
=
1
)[
0
]
if
start
is
None
else
start
end
=
pos
.
t
().
max
(
dim
=
1
)[
0
]
if
end
is
None
else
end
pos
,
end
=
pos
-
start
,
end
-
start
size
=
size
.
type_as
(
pos
)
count
=
(
end
/
size
).
long
()
+
1
cluster
=
count
.
new
(
pos
.
size
(
0
))
grid
(
cluster
,
pos
,
size
,
count
)
return
cluster
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment