to_backend

function of dascore.utils.array_api source

to_backend(
    array: Any ,
    backend: str ,
)-> ‘Any’

Return an array on the array library a name says.

Parameters

Parameter Description
array An array in memory, on any backend.
backend The name of the array library, as
backend_name reports it.

Raises

ParameterError If no array library of that name can be imported.

Examples

import numpy as np
from dascore.utils.array_api import to_backend

assert isinstance(to_backend(np.array([1, 2]), "numpy"), np.ndarray)