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
74199575
Commit
74199575
authored
Apr 28, 2018
by
rusty1s
Browse files
cleaner
parent
62331ad9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
torch_spline_conv/utils/ffi.py
torch_spline_conv/utils/ffi.py
+8
-8
No files found.
torch_spline_conv/utils/ffi.py
View file @
74199575
...
...
@@ -3,8 +3,8 @@ from .._ext import ffi
implemented_degrees
=
{
1
:
'linear'
,
2
:
'quadratic'
,
3
:
'cubic'
}
def
get_func
(
name
,
is_cuda
,
tensor
):
prefix
=
'THCC'
if
is_cuda
else
'TH'
def
get_func
(
name
,
tensor
):
prefix
=
'THCC'
if
tensor
.
is_cuda
else
'TH'
prefix
+=
tensor
.
type
().
split
(
'.'
)[
-
1
]
return
getattr
(
ffi
,
'{}_{}'
.
format
(
prefix
,
name
))
...
...
@@ -18,31 +18,31 @@ def get_degree_str(degree):
def
fw_basis
(
degree
,
basis
,
weight_index
,
pseudo
,
kernel_size
,
is_open_spline
):
name
=
'{}BasisForward'
.
format
(
get_degree_str
(
degree
))
func
=
get_func
(
name
,
basis
.
is_cuda
,
basis
)
func
=
get_func
(
name
,
basis
)
func
(
basis
,
weight_index
,
pseudo
,
kernel_size
,
is_open_spline
)
def
bw_basis
(
degree
,
self
,
grad_basis
,
pseudo
,
kernel_size
,
is_open_spline
):
name
=
'{}BasisBackward'
.
format
(
get_degree_str
(
degree
))
func
=
get_func
(
name
,
self
.
is_cuda
,
self
)
func
=
get_func
(
name
,
self
)
func
(
self
,
grad_basis
,
pseudo
,
kernel_size
,
is_open_spline
)
def
fw_weighting
(
self
,
src
,
weight
,
basis
,
weight_index
):
func
=
get_func
(
'weightingForward'
,
self
.
is_cuda
,
self
)
func
=
get_func
(
'weightingForward'
,
self
)
func
(
self
,
src
,
weight
,
basis
,
weight_index
)
def
bw_weighting_src
(
self
,
grad_output
,
weight
,
basis
,
weight_index
):
func
=
get_func
(
'weightingBackwardSrc'
,
self
.
is_cuda
,
self
)
func
=
get_func
(
'weightingBackwardSrc'
,
self
)
func
(
self
,
grad_output
,
weight
,
basis
,
weight_index
)
def
bw_weighting_weight
(
self
,
grad_output
,
src
,
basis
,
weight_index
):
func
=
get_func
(
'weightingBackwardWeight'
,
self
.
is_cuda
,
self
)
func
=
get_func
(
'weightingBackwardWeight'
,
self
)
func
(
self
,
grad_output
,
src
,
basis
,
weight_index
)
def
bw_weighting_basis
(
self
,
grad_output
,
src
,
weight
,
weight_index
):
func
=
get_func
(
'weightingBackwardBasis'
,
self
.
is_cuda
,
self
)
func
=
get_func
(
'weightingBackwardBasis'
,
self
)
func
(
self
,
grad_output
,
src
,
weight
,
weight_index
)
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