array_namespace

function of dascore.utils.array_api source

array_namespace(
    *arrays: Any ,
)-> ‘Any’

Return the array API namespace shared by arrays.

Array-likes which don’t implement the standard, but which numpy can consume through __array__, get the numpy namespace; numpy code is what has always handled them.

Parameters

Parameter Description
*arrays One or more arrays.

Examples

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

xp = array_namespace(np.array([1, 2]))
assert xp.sum(np.array([1, 2])) == 3