"vscode:/vscode.git/clone" did not exist on "fe7d5e9b8bd221685749146e9b42cd44f912891c"
Commit 0ea4cb8d authored by rusty1s's avatar rusty1s
Browse files

b-spline degree 2 fixes

parent 0a67b0f7
......@@ -26,7 +26,7 @@
int64_t kMod; \
T g = ScalarConvert<int, T>::to(0), v, tmp; \
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 = 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))); \
......@@ -35,7 +35,7 @@
\
for (dIt = 1; dIt < pseudo.size[1]; 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 = 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))); \
......
......@@ -72,7 +72,7 @@ def test_spline_basis_backward_cpu(degree):
def test_spline_basis_backward_gpu(degree):
kernel_size = torch.cuda.LongTensor([5, 5, 5])
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)
op = SplineBasis(degree, kernel_size, is_open_spline)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment