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
6146660b
Commit
6146660b
authored
Apr 10, 2018
by
rusty1s
Browse files
linting
parent
b5ac9f33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
test/test_conv.py
test/test_conv.py
+4
-4
torch_spline_conv/conv.py
torch_spline_conv/conv.py
+4
-1
No files found.
test/test_conv.py
View file @
6146660b
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# 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]]
# pseudo = Tensor(tensor, pseudo)
# pseudo = Tensor(tensor, pseudo)
#
weight = torch.arange(0.5, 0.5 * 25, step=0.5, out=x.new()).view(12, 2, 1)
# weight = torch.arange(0.5, 0.5 * 25, step=0.5, out=x.new()).view(12, 2, 1)
# kernel_size = torch.LongTensor([3, 4])
# kernel_size = torch.LongTensor([3, 4])
# is_open_spline = torch.ByteTensor([1, 0])
# is_open_spline = torch.ByteTensor([1, 0])
# root_weight = torch.arange(12.5, 13.5, step=0.5, out=x.new()).view(2, 1)
# root_weight = torch.arange(12.5, 13.5, step=0.5, out=x.new()).view(2, 1)
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
# weight = torch.DoubleTensor(25, 2, 4).uniform_(-1, 1)
# weight = torch.DoubleTensor(25, 2, 4).uniform_(-1, 1)
# weight = Variable(weight, requires_grad=True)
# weight = Variable(weight, requires_grad=True)
#
assert gradcheck(op, (x, pseudo, weight), eps=1e-6, atol=1e-4) is True
# assert gradcheck(op, (x, pseudo, weight), eps=1e-6, atol=1e-4) is True
# @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)
...
@@ -69,7 +69,7 @@
...
@@ -69,7 +69,7 @@
# 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]]
# pseudo = Tensor(tensor, pseudo)
# pseudo = Tensor(tensor, pseudo)
#
weight = torch.arange(0.5, 0.5 * 25, step=0.5, out=x.new()).view(12, 2, 1)
# weight = torch.arange(0.5, 0.5 * 25, step=0.5, out=x.new()).view(12, 2, 1)
# kernel_size = torch.LongTensor([3, 4])
# kernel_size = torch.LongTensor([3, 4])
# is_open_spline = torch.ByteTensor([1, 0])
# is_open_spline = torch.ByteTensor([1, 0])
# root_weight = torch.arange(12.5, 13.5, step=0.5, out=x.new()).view(2, 1)
# root_weight = torch.arange(12.5, 13.5, step=0.5, out=x.new()).view(2, 1)
...
@@ -109,4 +109,4 @@
...
@@ -109,4 +109,4 @@
# weight = torch.cuda.DoubleTensor(25, 2, 4).uniform_(-1, 1)
# weight = torch.cuda.DoubleTensor(25, 2, 4).uniform_(-1, 1)
# weight = Variable(weight, requires_grad=True)
# weight = Variable(weight, requires_grad=True)
#
assert gradcheck(op, (x, pseudo, weight), eps=1e-6, atol=1e-4) is True
# assert gradcheck(op, (x, pseudo, weight), eps=1e-6, atol=1e-4) is True
torch_spline_conv/conv.py
View file @
6146660b
# import torch
def
spline_conv
(
x
,
def
spline_conv
(
x
,
edge_index
,
edge_index
,
pseudo
,
pseudo
,
...
@@ -7,4 +10,4 @@ def spline_conv(x,
...
@@ -7,4 +10,4 @@ def spline_conv(x,
degree
=
1
,
degree
=
1
,
root_weight
=
None
,
root_weight
=
None
,
bias
=
None
):
bias
=
None
):
p
ass
p
seudo
=
pseudo
.
unsqueeze
(
-
1
)
if
pseudo
.
dim
()
==
1
else
pseudo
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