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-spline-conv
Commits
4ce1c05f
Commit
4ce1c05f
authored
Mar 23, 2018
by
rusty1s
Browse files
dont cover gpu tests
parent
952a4cad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
test/test_basis.py
test/test_basis.py
+1
-1
test/test_spline_conv.py
test/test_spline_conv.py
+10
-2
No files found.
test/test_basis.py
View file @
4ce1c05f
...
@@ -34,7 +34,7 @@ def test_spline_basis_cpu(tensor, i):
...
@@ -34,7 +34,7 @@ def test_spline_basis_cpu(tensor, i):
@
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,i'
,
product
(
tensors
,
range
(
len
(
data
))))
@
pytest
.
mark
.
parametrize
(
'tensor,i'
,
product
(
tensors
,
range
(
len
(
data
))))
def
test_spline_basis_gpu
(
tensor
,
i
):
def
test_spline_basis_gpu
(
tensor
,
i
):
# pragma: no cover
degree
=
data
[
i
].
get
(
'degree'
)
degree
=
data
[
i
].
get
(
'degree'
)
pseudo
=
Tensor
(
tensor
,
data
[
i
][
'pseudo'
]).
cuda
()
pseudo
=
Tensor
(
tensor
,
data
[
i
][
'pseudo'
]).
cuda
()
pseudo
=
pseudo
.
unsqueeze
(
-
1
)
if
pseudo
.
dim
()
==
1
else
pseudo
pseudo
=
pseudo
.
unsqueeze
(
-
1
)
if
pseudo
.
dim
()
==
1
else
pseudo
...
...
test/test_spline_conv.py
View file @
4ce1c05f
...
@@ -69,7 +69,7 @@ def test_spline_weighting_backward_cpu():
...
@@ -69,7 +69,7 @@ def test_spline_weighting_backward_cpu():
@
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_spline_conv_gpu
(
tensor
):
def
test_spline_conv_gpu
(
tensor
):
# pragma: no cover
x
=
Tensor
(
tensor
,
[[
9
,
10
],
[
1
,
2
],
[
3
,
4
],
[
5
,
6
],
[
7
,
8
]])
x
=
Tensor
(
tensor
,
[[
9
,
10
],
[
1
,
2
],
[
3
,
4
],
[
5
,
6
],
[
7
,
8
]])
edge_index
=
torch
.
LongTensor
([[
0
,
0
,
0
,
0
],
[
1
,
2
,
3
,
4
]])
edge_index
=
torch
.
LongTensor
([[
0
,
0
,
0
,
0
],
[
1
,
2
,
3
,
4
]])
pseudo
=
[[
0.25
,
0.125
],
[
0.25
,
0.375
],
[
0.75
,
0.625
],
[
0.75
,
0.875
]]
pseudo
=
[[
0.25
,
0.125
],
[
0.25
,
0.375
],
[
0.75
,
0.625
],
[
0.75
,
0.875
]]
...
@@ -92,9 +92,17 @@ def test_spline_conv_gpu(tensor):
...
@@ -92,9 +92,17 @@ def test_spline_conv_gpu(tensor):
is_open_spline
,
1
,
root_weight
,
bias
)
is_open_spline
,
1
,
root_weight
,
bias
)
assert
output
.
cpu
().
tolist
()
==
expected_output
.
tolist
()
assert
output
.
cpu
().
tolist
()
==
expected_output
.
tolist
()
x
,
weight
,
pseudo
=
Variable
(
x
),
Variable
(
weight
),
Variable
(
pseudo
)
root_weight
,
bias
=
Variable
(
root_weight
),
Variable
(
bias
)
output
=
spline_conv
(
x
,
edge_index
,
pseudo
,
weight
,
kernel_size
,
is_open_spline
,
1
,
root_weight
,
bias
)
assert
output
.
data
.
cpu
().
tolist
()
==
expected_output
.
tolist
()
@
pytest
.
mark
.
skipif
(
not
torch
.
cuda
.
is_available
(),
reason
=
'no CUDA'
)
@
pytest
.
mark
.
skipif
(
not
torch
.
cuda
.
is_available
(),
reason
=
'no CUDA'
)
def
test_spline_weighting_backward_gpu
():
def
test_spline_weighting_backward_gpu
():
# pragma: no cover
for
degree
in
implemented_degrees
.
keys
():
for
degree
in
implemented_degrees
.
keys
():
kernel_size
=
torch
.
cuda
.
LongTensor
([
5
,
5
,
5
])
kernel_size
=
torch
.
cuda
.
LongTensor
([
5
,
5
,
5
])
is_open_spline
=
torch
.
cuda
.
ByteTensor
([
1
,
0
,
1
])
is_open_spline
=
torch
.
cuda
.
ByteTensor
([
1
,
0
,
1
])
...
...
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