提交 7cb7558f authored 作者: Adrian Seyboldt's avatar Adrian Seyboldt 提交者: Adrian Seyboldt

Fix some sandbox tests

上级 3ef5ce79
...@@ -154,17 +154,17 @@ class ConvolutionIndices(Op): ...@@ -154,17 +154,17 @@ class ConvolutionIndices(Op):
# FOR EACH OUTPUT PIXEL... # FOR EACH OUTPUT PIXEL...
# loop over output image height # loop over output image height
for oy in np.arange(lbound[0], ubound[0], dy): for oy in np.arange(lbound[0], ubound[0], dy, dtype=int):
# loop over output image width # loop over output image width
for ox in np.arange(lbound[1], ubound[1], dx): for ox in np.arange(lbound[1], ubound[1], dx, dtype=int):
# kern[l] is filter value to apply at (oj,oi) # kern[l] is filter value to apply at (oj,oi)
# for (iy,ix) # for (iy,ix)
l = 0 # noqa: E741 l = 0 # noqa: E741
# ... ITERATE OVER INPUT UNITS IN RECEPTIVE FIELD # ... ITERATE OVER INPUT UNITS IN RECEPTIVE FIELD
for ky in oy + np.arange(kshp[0]): for ky in oy + np.arange(kshp[0], dtype=int):
for kx in ox + np.arange(kshp[1]): for kx in ox + np.arange(kshp[1], dtype=int):
# verify if we are still within image # verify if we are still within image
# boundaries. Equivalent to # boundaries. Equivalent to
...@@ -176,13 +176,13 @@ class ConvolutionIndices(Op): ...@@ -176,13 +176,13 @@ class ConvolutionIndices(Op):
# convert to "valid" input space # convert to "valid" input space
# coords used to determine column # coords used to determine column
# index to write to in sparse mat # index to write to in sparse mat
iy, ix = np.array((ky, kx)) - topleft iy, ix = np.array((ky, kx), dtype=int) - topleft
# determine raster-index of input pixel... # determine raster-index of input pixel...
# taking into account multiple # taking into account multiple
# input features # input features
col = int( col = int(
iy * inshp[2] + ix + fmapi * np.prod(inshp[1:]) iy * inshp[2] + ix + fmapi * np.prod(inshp[1:], dtype=int)
) )
# convert oy,ox values to output # convert oy,ox values to output
...@@ -192,7 +192,7 @@ class ConvolutionIndices(Op): ...@@ -192,7 +192,7 @@ class ConvolutionIndices(Op):
else: else:
(y, x) = (oy, ox) - topleft (y, x) = (oy, ox) - topleft
# taking into account step size # taking into account step size
(y, x) = np.array([y, x]) / (dy, dx) (y, x) = np.array([y, x], dtype=int) / (dy, dx)
# convert to row index of sparse matrix # convert to row index of sparse matrix
if ws: if ws:
...@@ -212,7 +212,7 @@ class ConvolutionIndices(Op): ...@@ -212,7 +212,7 @@ class ConvolutionIndices(Op):
# onto the sparse columns (idea of # onto the sparse columns (idea of
# kernel map) # kernel map)
# n*... only for sparse # n*... only for sparse
spmat[row + n * outsize, col] = tapi + 1 spmat[int(row + n * outsize), int(col)] = tapi + 1
# total number of active taps # total number of active taps
# (used for kmap) # (used for kmap)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论