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
8f006b2d
Commit
8f006b2d
authored
Mar 11, 2018
by
rusty1s
Browse files
outsource spline conv
parent
5e006b95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
torch_spline_conv/functions/spline_conv.py
torch_spline_conv/functions/spline_conv.py
+23
-10
No files found.
torch_spline_conv/functions/spline_conv.py
View file @
8f006b2d
...
@@ -5,15 +5,13 @@ from .degree import node_degree
...
@@ -5,15 +5,13 @@ from .degree import node_degree
from
.utils
import
spline_basis
,
spline_weighting
from
.utils
import
spline_basis
,
spline_weighting
def
spline_conv
(
x
,
def
_spline_conv
(
x
,
edge_index
,
edge_index
,
pseudo
,
pseudo
,
weight
,
weight
,
kernel_size
,
kernel_size
,
is_open_spline
,
is_open_spline
,
root_weight
=
None
,
degree
=
1
):
degree
=
1
,
bias
=
None
):
n
,
e
=
x
.
size
(
0
),
edge_index
.
size
(
1
)
n
,
e
=
x
.
size
(
0
),
edge_index
.
size
(
1
)
K
,
m_in
,
m_out
=
weight
.
size
()
K
,
m_in
,
m_out
=
weight
.
size
()
...
@@ -34,7 +32,22 @@ def spline_conv(x,
...
@@ -34,7 +32,22 @@ def spline_conv(x,
row
=
edge_index
[
0
].
unsqueeze
(
-
1
).
expand
(
e
,
m_out
)
row
=
edge_index
[
0
].
unsqueeze
(
-
1
).
expand
(
e
,
m_out
)
row
=
row
if
torch
.
is_tensor
(
x
)
else
Var
(
row
)
row
=
row
if
torch
.
is_tensor
(
x
)
else
Var
(
row
)
zero
=
x
.
new
(
n
,
m_out
)
if
torch
.
is_tensor
(
x
)
else
Var
(
x
.
data
.
new
(
n
,
m_out
))
zero
=
x
.
new
(
n
,
m_out
)
if
torch
.
is_tensor
(
x
)
else
Var
(
x
.
data
.
new
(
n
,
m_out
))
output
=
zero
.
fill_
(
0
).
scatter_add_
(
0
,
row
,
output
)
return
zero
.
fill_
(
0
).
scatter_add_
(
0
,
row
,
output
)
def
spline_conv
(
x
,
edge_index
,
pseudo
,
weight
,
kernel_size
,
is_open_spline
,
root_weight
=
None
,
degree
=
1
,
bias
=
None
):
n
=
x
.
size
(
0
)
output
=
_spline_conv
(
x
,
edge_index
,
pseudo
,
weight
,
kernel_size
,
is_open_spline
,
degree
)
# Normalize output by node degree.
# Normalize output by node degree.
degree
=
x
.
new
()
if
torch
.
is_tensor
(
x
)
else
x
.
data
.
new
()
degree
=
x
.
new
()
if
torch
.
is_tensor
(
x
)
else
x
.
data
.
new
()
...
...
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