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
e094c3bf
Commit
e094c3bf
authored
Apr 07, 2018
by
rusty1s
Browse files
added assert
parent
eb413124
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
torch_cluster/grid.py
torch_cluster/grid.py
+3
-0
No files found.
torch_cluster/grid.py
View file @
e094c3bf
...
@@ -4,6 +4,9 @@ from .utils.ffi import grid
...
@@ -4,6 +4,9 @@ from .utils.ffi import grid
def
grid_cluster
(
pos
,
size
,
start
=
None
,
end
=
None
):
def
grid_cluster
(
pos
,
size
,
start
=
None
,
end
=
None
):
pos
=
pos
.
unsqueeze
(
-
1
)
if
pos
.
dim
()
==
1
else
pos
pos
=
pos
.
unsqueeze
(
-
1
)
if
pos
.
dim
()
==
1
else
pos
assert
pos
.
size
(
1
)
==
size
.
size
(
0
),
(
'Last dimension of position tensor must have same size as size tensor'
)
start
=
pos
.
t
().
min
(
dim
=
1
)[
0
]
if
start
is
None
else
start
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
end
=
pos
.
t
().
max
(
dim
=
1
)[
0
]
if
end
is
None
else
end
pos
,
end
=
pos
-
start
,
end
-
start
pos
,
end
=
pos
-
start
,
end
-
start
...
...
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