{ } Raw JSON

bundles / scipy 1.17.1 / scipy / _lib / array_api_compat / common / _helpers / device

function

scipy._lib.array_api_compat.common._helpers:device

source: /scipy/_lib/array_api_compat/common/_helpers.py :722

Signature

def   device ( x : _ArrayApiObj / )  →  Device

Summary

Hardware device the array data resides on.

Extended Summary

This is equivalent to x.device according to the standard. This helper is included because some array libraries either do not have the device attribute or include it with an incompatible API.

Parameters

x: array

array instance from an array API compatible library.

Returns

: out: device

a device object (see the Device Support section of the array API specification).

Notes

For NumPy the device is always "cpu". For Dask, the device is always a special DASK_DEVICE object.

See also

to_device

Move array data to a different device.

Aliases

  • scipy.signal._polyutils.xp_device