Add the to_device method to the array_api
This method is new since It does nothing in NumPy since NumPy does not
support non-CPU devices.
@@ -989,6 +989,11 @@ class Array:
res = self._array.__rxor__(other._array)
return self.__class__._new(res)
+ def to_device(self: Array, device: Device, /) -> Array:
+ if device == 'cpu':
+ return self
+ raise ValueError(f"Unsupported device {device!r}")
+
@property
def dtype(self) -> Dtype:
"""
