Skip to content

Commit ce89a2d

Browse files
committed
bug: added safeguards to get_module_name
Added safeguards to ensure cp and jnp are reached only if installed.
1 parent d62f4f4 commit ce89a2d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pylops/utils/backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ def get_module_name(mod: ModuleType) -> str:
114114
"""
115115
if mod == np:
116116
backend = "numpy"
117-
elif mod == cp:
117+
elif deps.cupy_enabled and mod == cp:
118118
backend = "cupy"
119-
elif mod == jnp:
119+
elif deps.jax_enabled and mod == jnp:
120120
backend = "jax"
121121
else:
122122
raise ValueError("module must be numpy, cupy, or jax")

0 commit comments

Comments
 (0)