MCPcopy Index your code
hub / github.com/dask/dask / asarray_safe

Function asarray_safe

dask/array/utils.py:486–497  ·  view source on GitHub ↗

If a is dask.array, return dask.array.asarray(a, **kwargs), otherwise return np.asarray(a, like=like, **kwargs), dispatching the call to the library that implements the like array. Note that when a is a dask.Array but like isn't, this function will call a.compute(scheduler="sync

(a, like, **kwargs)

Source from the content-addressed store, hash-verified

484
485
486def asarray_safe(a, like, **kwargs):
487 """
488 If a is dask.array, return dask.array.asarray(a, **kwargs),
489 otherwise return np.asarray(a, like=like, **kwargs), dispatching
490 the call to the library that implements the like array. Note that
491 when a is a dask.Array but like isn't, this function will call
492 a.compute(scheduler="sync") before np.asarray, as downstream
493 libraries are unlikely to know how to convert a dask.Array.
494 """
495 from dask.array.core import asarray
496
497 return _array_like_safe(np.asarray, asarray, a, like, **kwargs)
498
499
500def asanyarray_safe(a, like, **kwargs):

Callers 15

takeFunction · 0.90
asarrayFunction · 0.90
_nanmin_skipFunction · 0.90
_nanmax_skipFunction · 0.90
arg_reductionFunction · 0.90
quantileFunction · 0.90
nanquantileFunction · 0.90
_choice_validate_paramsFunction · 0.90
diffFunction · 0.90
digitizeFunction · 0.90
trilFunction · 0.90

Calls 1

_array_like_safeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…