From 60997e0028cb1f8aa5569a6ecadb78dc3cd9ae4f Mon Sep 17 00:00:00 2001 From: mrava87 Date: Wed, 22 May 2024 21:08:53 +0300 Subject: [PATCH] bug: fixes https://github.com/PyLops/pylops/issues/579 --- pylops/utils/backend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pylops/utils/backend.py b/pylops/utils/backend.py index 1cef8bdb..8e38505f 100644 --- a/pylops/utils/backend.py +++ b/pylops/utils/backend.py @@ -437,5 +437,6 @@ def to_cupy_conditional(x: npt.ArrayLike, y: npt.ArrayLike) -> NDArray: """ if deps.cupy_enabled: if cp.get_array_module(x) == cp and cp.get_array_module(y) == np: - y = cp.asarray(y) + with cp.cuda.Device(x.device): + y = cp.asarray(y) return y