Skip to content

Commit 1d8ca5b

Browse files
committed
Fix some sandbox tests
1 parent b1574cd commit 1d8ca5b

File tree

1 file changed

+8
-8
lines changed
  • aesara/sparse/sandbox

1 file changed

+8
-8
lines changed

aesara/sparse/sandbox/sp.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,17 @@ def evaluate(inshp, kshp, strides=(1, 1), nkern=1, mode="valid", ws=True):
154154

155155
# FOR EACH OUTPUT PIXEL...
156156
# loop over output image height
157-
for oy in np.arange(lbound[0], ubound[0], dy):
157+
for oy in np.arange(lbound[0], ubound[0], dy, dtype=int):
158158
# loop over output image width
159-
for ox in np.arange(lbound[1], ubound[1], dx):
159+
for ox in np.arange(lbound[1], ubound[1], dx, dtype=int):
160160

161161
# kern[l] is filter value to apply at (oj,oi)
162162
# for (iy,ix)
163163
l = 0 # noqa: E741
164164

165165
# ... ITERATE OVER INPUT UNITS IN RECEPTIVE FIELD
166-
for ky in oy + np.arange(kshp[0]):
167-
for kx in ox + np.arange(kshp[1]):
166+
for ky in oy + np.arange(kshp[0], dtype=int):
167+
for kx in ox + np.arange(kshp[1], dtype=int):
168168

169169
# verify if we are still within image
170170
# boundaries. Equivalent to
@@ -176,13 +176,13 @@ def evaluate(inshp, kshp, strides=(1, 1), nkern=1, mode="valid", ws=True):
176176
# convert to "valid" input space
177177
# coords used to determine column
178178
# index to write to in sparse mat
179-
iy, ix = np.array((ky, kx)) - topleft
179+
iy, ix = np.array((ky, kx), dtype=int) - topleft
180180
# determine raster-index of input pixel...
181181

182182
# taking into account multiple
183183
# input features
184184
col = (
185-
iy * inshp[2] + ix + fmapi * np.prod(inshp[1:])
185+
iy * inshp[2] + ix + fmapi * np.prod(inshp[1:], dtype=int)
186186
)
187187

188188
# convert oy,ox values to output
@@ -192,7 +192,7 @@ def evaluate(inshp, kshp, strides=(1, 1), nkern=1, mode="valid", ws=True):
192192
else:
193193
(y, x) = (oy, ox) - topleft
194194
# taking into account step size
195-
(y, x) = np.array([y, x]) / (dy, dx)
195+
(y, x) = np.array([y, x], dtype=int) / (dy, dx)
196196

197197
# convert to row index of sparse matrix
198198
if ws:
@@ -212,7 +212,7 @@ def evaluate(inshp, kshp, strides=(1, 1), nkern=1, mode="valid", ws=True):
212212
# onto the sparse columns (idea of
213213
# kernel map)
214214
# n*... only for sparse
215-
spmat[row + n * outsize, col] = tapi + 1
215+
spmat[int(row + n * outsize), int(col)] = tapi + 1
216216

217217
# total number of active taps
218218
# (used for kmap)

0 commit comments

Comments
 (0)