Skip to content

Commit

Permalink
minor: removed functions in backend
Browse files Browse the repository at this point in the history
  • Loading branch information
mrava87 committed Dec 4, 2024
1 parent ea98081 commit b8d4ee3
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions pylops/utils/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
"get_sp_fft",
"get_complex_dtype",
"get_real_dtype",
"to_cupy",
"to_numpy",
"to_cupy_conditional",
"to_numpy_conditional",
"inplace_set",
"inplace_add",
"inplace_multiply",
Expand Down Expand Up @@ -486,26 +484,6 @@ def get_real_dtype(dtype: DTypeLike) -> DTypeLike:
return np.real(np.ones(1, dtype)).dtype


def to_cupy(x: NDArray) -> NDArray:
"""Convert x to cupy array
Parameters
----------
x : :obj:`numpy.ndarray` or :obj:`cupy.ndarray`
Array to evaluate
Returns
-------
x : :obj:`numpy.ndarray`
Converted array
"""
if deps.cupy_enabled:
if cp.get_array_module(x) == np:
x = cp.asarray(x)
return x


def to_numpy(x: NDArray) -> NDArray:
"""Convert x to numpy array
Expand Down Expand Up @@ -549,28 +527,6 @@ def to_cupy_conditional(x: npt.ArrayLike, y: npt.ArrayLike) -> NDArray:
return y


def to_numpy_conditional(x: npt.ArrayLike, y: npt.ArrayLike) -> NDArray:
"""Convert y to numpy array conditional to x being a numpy array
Parameters
----------
x : :obj:`numpy.ndarray` or :obj:`cupy.ndarray`
Array to evaluate
y : :obj:`numpy.ndarray`
Array to convert
Returns
-------
y : :obj:`cupy.ndarray`
Converted array
"""
if deps.cupy_enabled:
if cp.get_array_module(x) == np and cp.get_array_module(y) == cp:
y = cp.asnumpy(y)
return y


def inplace_set(x: npt.ArrayLike, y: npt.ArrayLike, idx: list) -> NDArray:
"""Perform inplace set based on input
Expand Down

0 comments on commit b8d4ee3

Please sign in to comment.