If a is dask.array, return dask.array.asanyarray(a, **kwargs), otherwise return np.asanyarray(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
(a, like, **kwargs)
| 498 | |
| 499 | |
| 500 | def asanyarray_safe(a, like, **kwargs): |
| 501 | """ |
| 502 | If a is dask.array, return dask.array.asanyarray(a, **kwargs), |
| 503 | otherwise return np.asanyarray(a, like=like, **kwargs), dispatching |
| 504 | the call to the library that implements the like array. Note that |
| 505 | when a is a dask.Array but like isn't, this function will call |
| 506 | a.compute(scheduler="sync") before np.asanyarray, as downstream |
| 507 | libraries are unlikely to know how to convert a dask.Array. |
| 508 | """ |
| 509 | from dask.array.core import asanyarray |
| 510 | |
| 511 | return _array_like_safe(np.asanyarray, asanyarray, a, like, **kwargs) |
| 512 | |
| 513 | |
| 514 | def validate_axis(axis, ndim): |
no test coverage detected
searching dependent graphs…