device``. This is equivalent to `x.to_device(device, stream=stream)` according to the `standard `__. This helper is included because some array libraries do not have the `to_device` method. Parameters ---------- x: array array instance from an array API compatible library. device: device a ``device`` object (see the `Device Support `__ section of the array API specification). stream: Optional[Union[int, Any]] stream object to use during copy. In addition to the types supported in ``array.__dlpack__``, implementations may choose to support any library-specific stream object with the caveat that any code using such an object would not be portable. Returns ------- out: array an array with the same data and data type as ``x`` and located on the specified ``device``. Notes ----- For NumPy, this function effectively does nothing since the only supported device is the CPU. For CuPy, this method supports CuPy CUDA :external+cupy:class:`Device ` and :external+cupy:class:`Stream ` objects. For PyTorch, this is the same as :external+torch:meth:`x.to(device) ` (the ``stream`` argument is not supported in PyTorch). See Also -------- device : Hardware device the array data resides on. Nz3The stream argument to to_device() is not supportedrz