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
0ea4cb8d
Commit
0ea4cb8d
authored
Apr 12, 2018
by
rusty1s
Browse files
b-spline degree 2 fixes
parent
0a67b0f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
aten/THC/THCBasisBackward.cuh
aten/THC/THCBasisBackward.cuh
+2
-2
test/test_basis.py
test/test_basis.py
+1
-1
No files found.
aten/THC/THCBasisBackward.cuh
View file @
0ea4cb8d
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
int64_t kMod; \
int64_t kMod; \
T g = ScalarConvert<int, T>::to(0), v, tmp; \
T g = ScalarConvert<int, T>::to(0), v, tmp; \
for (s = 0; s < gradBasis.size[1]; s++) { \
for (s = 0; s < gradBasis.size[1]; s++) { \
kMod = (s / (ptrdiff_t) pow(
M + 1,
d)) % (M + 1); \
kMod = (s / (ptrdiff_t) pow(
(float) M + 1, (float)
d)) % (M + 1); \
v = pseudo.data[e * pseudo.stride[0] + d * pseudo.stride[1]]; \
v = pseudo.data[e * pseudo.stride[0] + d * pseudo.stride[1]]; \
v = THCNumerics<T>::mul(v, ScalarConvert<int64_t, T>::to(kernelSize[d] - M * isOpenSpline[d])); \
v = THCNumerics<T>::mul(v, ScalarConvert<int64_t, T>::to(kernelSize[d] - M * isOpenSpline[d])); \
v = THCNumerics<T>::sub(v, ScalarConvert<int64_t, T>::to(ScalarConvert<T, int64_t>::to(v))); \
v = THCNumerics<T>::sub(v, ScalarConvert<int64_t, T>::to(ScalarConvert<T, int64_t>::to(v))); \
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
\
\
for (dIt = 1; dIt < pseudo.size[1]; dIt++) { \
for (dIt = 1; dIt < pseudo.size[1]; dIt++) { \
dOther = dIt - (d >= dIt); \
dOther = dIt - (d >= dIt); \
kMod = (s / (ptrdiff_t) pow(
M + 1,
dOther)) % (M + 1); \
kMod = (s / (ptrdiff_t) pow(
(float) M + 1, (float)
dOther)) % (M + 1); \
v = pseudo.data[e * pseudo.stride[0] + dOther * pseudo.stride[1]]; \
v = pseudo.data[e * pseudo.stride[0] + dOther * pseudo.stride[1]]; \
v = THCNumerics<T>::mul(v, ScalarConvert<int64_t, T>::to(kernelSize[dOther] - M * isOpenSpline[dOther])); \
v = THCNumerics<T>::mul(v, ScalarConvert<int64_t, T>::to(kernelSize[dOther] - M * isOpenSpline[dOther])); \
v = THCNumerics<T>::sub(v, ScalarConvert<int64_t, T>::to(ScalarConvert<T, int64_t>::to(v))); \
v = THCNumerics<T>::sub(v, ScalarConvert<int64_t, T>::to(ScalarConvert<T, int64_t>::to(v))); \
...
...
test/test_basis.py
View file @
0ea4cb8d
...
@@ -72,7 +72,7 @@ def test_spline_basis_backward_cpu(degree):
...
@@ -72,7 +72,7 @@ def test_spline_basis_backward_cpu(degree):
def
test_spline_basis_backward_gpu
(
degree
):
def
test_spline_basis_backward_gpu
(
degree
):
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
])
pseudo
=
torch
.
cuda
.
DoubleTensor
(
4
,
1
).
uniform_
(
0
,
1
)
pseudo
=
torch
.
cuda
.
DoubleTensor
(
4
,
3
).
uniform_
(
0
,
1
)
pseudo
=
Variable
(
pseudo
,
requires_grad
=
True
)
pseudo
=
Variable
(
pseudo
,
requires_grad
=
True
)
op
=
SplineBasis
(
degree
,
kernel_size
,
is_open_spline
)
op
=
SplineBasis
(
degree
,
kernel_size
,
is_open_spline
)
...
...
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