asarray_like

function of dascore.utils.array_api source

asarray_like(
    array: Any ,
    like: Any ,
)-> ‘Any’

Return array converted to the backend and device of like.

Parameters

Parameter Description
array The array to convert.
like An array whose backend and device the output should match.

Examples

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

out = asarray_like(np.array([1, 2]), np.array([3.0]))
assert isinstance(out, np.ndarray)