Device#
- class ivy.data_classes.array.device._ArrayWithDevice[source]#
Bases:
ABC
- _abc_impl = <_abc_data object>#
- dev(*, as_native=False)[source]#
ivy.Array instance method variant of ivy.dev. This method simply wraps the function, and so the docstring for ivy.dev also applies to this method with minimal changes.
- Parameters:
self (
Array
) – array for which to get the device handle.as_native (
bool
) – Whether or not to return the dev in native format. Default isFalse
. (default:False
)
Examples
>>> x = ivy.array([[2, 5, 4, 1], [3, 1, 5, 2]]) >>> y = x.dev(as_native=True) >>> print(y) cpu
- Return type:
Union
[Device
,NativeDevice
]
- to_device(device, *, stream=None, out=None)[source]#
ivy.Array instance method variant of ivy.to_device. This method simply wraps the function, and so the docstring for ivy.to_device also applies to this method with minimal changes.
- Parameters:
self (
Array
) – input array to be moved to the desired devicedevice (
Union
[Device
,NativeDevice
]) – device to move the input array x tostream (
Optional
[Union
[int
,Any
]]) – stream object to use during copy. In addition to the types (default:None
) 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.out (
Optional
[Array
]) – optional output array, for writing the result to. It must have (default:None
) a shape that the inputs broadcast to.
Examples
>>> x = ivy.array([2, 5, 4, 1]) >>> y = x.to_device('cpu') >>> print(y.device) cpu
- Return type:
Array