Skip to content

Commit 127620b

Browse files
committed
bug: fix problem in Restriction when passing iava as cupy array
1 parent bcd4da2 commit 127620b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pylops/basicoperators/restriction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
get_normalize_axis_index,
1414
inplace_set,
1515
to_cupy_conditional,
16+
to_numpy,
1617
)
1718
from pylops.utils.typing import DTypeLike, InputDimsLike, IntNDArray, NDArray
1819

@@ -146,7 +147,7 @@ def __init__(
146147
# explicitly create a list of indices in the n-dimensional
147148
# model space which will be used in _rmatvec to place the input
148149
if ncp != np:
149-
self.iavamask = _compute_iavamask(self.dims, axis, iava, ncp)
150+
self.iavamask = _compute_iavamask(self.dims, axis, to_numpy(iava), ncp)
150151
self.inplace = inplace
151152
self.axis = axis
152153
self.iavareshape = iavareshape
@@ -173,7 +174,6 @@ def _rmatvec(self, x: NDArray) -> NDArray:
173174
)
174175
else:
175176
if not hasattr(self, "iavamask"):
176-
self.iava = to_cupy_conditional(x, self.iava)
177177
self.iavamask = _compute_iavamask(self.dims, self.axis, self.iava, ncp)
178178
y = ncp.zeros(int(self.shape[-1]), dtype=self.dtype)
179179
y = inplace_set(x.ravel(), y, self.iavamask)

0 commit comments

Comments
 (0)