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
99baecdf
Commit
99baecdf
authored
Jan 31, 2018
by
rusty1s
Browse files
added gpu tests
parent
72b1ce14
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
test/test_grid.py
test/test_grid.py
+17
-1
No files found.
test/test_grid.py
View file @
99baecdf
...
@@ -29,4 +29,20 @@ def test_grid_cluster_cpu(tensor):
...
@@ -29,4 +29,20 @@ def test_grid_cluster_cpu(tensor):
@
pytest
.
mark
.
skipif
(
not
torch
.
cuda
.
is_available
(),
reason
=
'no CUDA'
)
@
pytest
.
mark
.
skipif
(
not
torch
.
cuda
.
is_available
(),
reason
=
'no CUDA'
)
@
pytest
.
mark
.
parametrize
(
'tensor'
,
tensors
)
@
pytest
.
mark
.
parametrize
(
'tensor'
,
tensors
)
def
test_grid_cluster_gpu
(
tensor
):
# pragma: no cover
def
test_grid_cluster_gpu
(
tensor
):
# pragma: no cover
pass
position
=
Tensor
(
tensor
,
[[
0
,
0
],
[
9
,
9
],
[
2
,
8
],
[
2
,
2
],
[
8
,
3
]]).
cuda
()
size
=
torch
.
cuda
.
LongTensor
([
5
,
5
])
expected
=
torch
.
LongTensor
([
0
,
3
,
1
,
0
,
2
])
output
=
grid_cluster
(
position
,
size
)
assert
output
.
cpu
().
tolist
()
==
expected
.
tolist
()
output
=
grid_cluster
(
position
.
expand
(
2
,
5
,
2
),
size
)
assert
output
.
cpu
().
tolist
()
==
expected
.
expand
(
2
,
5
).
tolist
()
expected
=
torch
.
LongTensor
([
0
,
1
,
3
,
2
,
4
])
batch
=
torch
.
cuda
.
LongTensor
([
0
,
0
,
1
,
1
,
1
])
output
=
grid_cluster
(
position
,
size
,
batch
)
assert
output
.
cpu
().
tolist
()
==
expected
.
tolist
()
output
=
grid_cluster
(
position
.
expand
(
2
,
5
,
2
),
size
,
batch
.
expand
(
2
,
5
))
assert
output
.
cpu
().
tolist
()
==
expected
.
expand
(
2
,
5
).
tolist
()
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