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
70762c5e
Commit
70762c5e
authored
Mar 09, 2018
by
rusty1s
Browse files
fixed tests
parent
16cbb7ab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
8 deletions
+14
-8
test/basis.json
test/basis.json
+6
-6
torch_spline_conv/functions/utils.py
torch_spline_conv/functions/utils.py
+1
-1
torch_spline_conv/src/cpu.h
torch_spline_conv/src/cpu.h
+6
-0
torch_spline_conv/src/generic/cpu.c
torch_spline_conv/src/generic/cpu.c
+1
-1
No files found.
test/basis.json
View file @
70762c5e
...
...
@@ -4,23 +4,23 @@
"pseudo"
:
[
0
,
0.125
,
0.25
,
0.5
,
0.75
,
0.875
,
1
],
"kernel_size"
:
[
5
],
"is_open_spline"
:
[
1
],
"expected_basis"
:
[[
0
,
1
],
[
0.5
,
0.5
],
[
0
,
1
],
[
0
,
1
],
[
0
,
1
],
[
0.5
,
0.5
],
[
0
,
1
]],
"expected_index"
:
[[
1
,
0
],
[
1
,
0
],
[
2
,
1
],
[
3
,
2
],
[
4
,
3
],
[
4
,
3
],
[
0
,
4
]]
"expected_basis"
:
[[
1
,
0
],
[
0.5
,
0.5
],
[
1
,
0
],
[
1
,
0
],
[
1
,
0
],
[
0.5
,
0.5
],
[
1
,
0
]],
"expected_index"
:
[[
0
,
1
],
[
0
,
1
],
[
1
,
2
],
[
2
,
3
],
[
3
,
4
],
[
3
,
4
],
[
4
,
0
]]
},
{
"degree"
:
1
,
"pseudo"
:
[
0
,
0.125
,
0.25
,
0.5
,
0.75
,
0.875
,
1
],
"kernel_size"
:
[
4
],
"is_open_spline"
:
[
0
],
"expected_basis"
:
[[
0
,
1
],
[
0.5
,
0.5
],
[
0
,
1
],
[
0
,
1
],
[
0
,
1
],
[
0.5
,
0.5
],
[
0
,
1
]],
"expected_index"
:
[[
1
,
0
],
[
1
,
0
],
[
2
,
1
],
[
3
,
2
],
[
0
,
3
],
[
0
,
3
],
[
1
,
0
]]
"expected_basis"
:
[[
1
,
0
],
[
0.5
,
0.5
],
[
1
,
0
],
[
1
,
0
],
[
1
,
0
],
[
0.5
,
0.5
],
[
1
,
0
]],
"expected_index"
:
[[
0
,
1
],
[
0
,
1
],
[
1
,
2
],
[
2
,
3
],
[
3
,
0
],
[
3
,
0
],
[
0
,
1
]]
},
{
"degree"
:
1
,
"pseudo"
:
[[
0.125
,
0.5
],
[
0.5
,
0.5
],
[
0.75
,
0.125
]],
"kernel_size"
:
[
5
,
5
],
"is_open_spline"
:
[
1
,
1
],
"expected_basis"
:
[[
0
,
0
,
0
.5
,
0
.5
],
[
0
,
0
,
0
,
1
],
[
0
,
0.5
,
0
,
0.5
]],
"expected_index"
:
[[
8
,
3
,
7
,
2
],
[
1
8
,
1
3
,
1
7
,
1
2
],
[
2
1
,
16
,
2
0
,
15
]]
"expected_basis"
:
[[
0
.5
,
0
.5
,
0
,
0
],
[
1
,
0
,
0
,
0
],
[
0.5
,
0
,
0.5
,
0
]],
"expected_index"
:
[[
2
,
7
,
3
,
8
],
[
1
2
,
1
7
,
1
3
,
1
8
],
[
1
5
,
20
,
16
,
2
1
]]
}
]
torch_spline_conv/functions/utils.py
View file @
70762c5e
...
...
@@ -3,7 +3,7 @@ from torch.autograd import Function
from
.._ext
import
ffi
implemented_degrees
=
{
1
:
'linear'
,
2
:
'quadric'
,
3
:
'cubic'
}
implemented_degrees
=
{
1
:
'linear'
,
2
:
'quadr
at
ic'
,
3
:
'cubic'
}
def
get_func
(
name
,
tensor
):
...
...
torch_spline_conv/src/cpu.h
View file @
70762c5e
void
spline_basis_linear_Float
(
THFloatTensor
*
basis
,
THLongTensor
*
weight_index
,
THFloatTensor
*
pseudo
,
THLongTensor
*
kernel_size
,
THByteTensor
*
is_open_spline
,
int
K
);
void
spline_basis_linear_Double
(
THDoubleTensor
*
basis
,
THLongTensor
*
weight_index
,
THDoubleTensor
*
pseudo
,
THLongTensor
*
kernel_size
,
THByteTensor
*
is_open_spline
,
int
K
);
void
spline_basis_quadratic_Float
(
THFloatTensor
*
basis
,
THLongTensor
*
weight_index
,
THFloatTensor
*
pseudo
,
THLongTensor
*
kernel_size
,
THByteTensor
*
is_open_spline
,
int
K
);
void
spline_basis_quadratic_Double
(
THDoubleTensor
*
basis
,
THLongTensor
*
weight_index
,
THDoubleTensor
*
pseudo
,
THLongTensor
*
kernel_size
,
THByteTensor
*
is_open_spline
,
int
K
);
void
spline_basis_cubic_Float
(
THFloatTensor
*
basis
,
THLongTensor
*
weight_index
,
THFloatTensor
*
pseudo
,
THLongTensor
*
kernel_size
,
THByteTensor
*
is_open_spline
,
int
K
);
void
spline_basis_cubic_Double
(
THDoubleTensor
*
basis
,
THLongTensor
*
weight_index
,
THDoubleTensor
*
pseudo
,
THLongTensor
*
kernel_size
,
THByteTensor
*
is_open_spline
,
int
K
);
torch_spline_conv/src/generic/cpu.c
View file @
70762c5e
...
...
@@ -29,7 +29,7 @@
void
spline_
(
basis_linear
)(
THTensor
*
basis
,
THLongTensor
*
weight_index
,
THTensor
*
pseudo
,
THLongTensor
*
kernel_size
,
THByteTensor
*
is_open_spline
,
int
K
)
{
SPLINE_BASIS
(
1
,
basis
,
weight_index
,
pseudo
,
kernel_size
,
is_open_spline
,
K
,
value
=
(
1
-
k_mod
)
*
value
+
k_mod
*
(
1
-
value
)
;
value
=
(
1
-
k_mod
)
*
(
1
-
value
)
+
k_mod
*
value
;
)
}
...
...
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