dev#
- ivy.dev(x, /, *, as_native=False)[source]#
Get the native device handle for input array x.
- Parameters:
x (
Union
[Array
,NativeArray
]) – array for which to get the device handle.as_native (
bool
, default:False
) – Whether or not to return the dev in native format. Default isFalse
.
- Return type:
Union
[Device
,NativeDevice
]- Returns:
- ret
Device handle for the array.
Examples
With
ivy.Array
input:>>> x = ivy.array([3, 1, 4, 5]) >>> y = ivy.dev(x) >>> print(y) cpu
With
ivy.NativeArray
input:>>> x = ivy.native_array([[2, 5, 4], [3, 1, 5]]) >>> y = ivy.dev(x, as_native=True) >>> print(y) cpu
- Array.dev(self, *, 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
, default:False
) – Whether or not to return the dev in native format. Default isFalse
.
- Return type:
Union
[Device
,NativeDevice
]
Examples
>>> x = ivy.array([[2, 5, 4, 1], [3, 1, 5, 2]]) >>> y = x.dev(as_native=True) >>> print(y) cpu
- Container.dev(self, as_native=False)[source]#
ivy.Container 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 (
Container
) – contaioner of arrays for which to get the device handle.as_native (
Union
[bool
,Container
], default:False
) – Whether or not to return the dev in native format. Default isFalse
.
- Return type:
Container
Examples
>>> x = ivy.Container(a=ivy.array([[2, 3, 1], [3, 5, 3]]), ... b=ivy.native_array([[1, 2], [4, 5]])) >>> as_native = ivy.Container(a=False, b=True) >>> y = x.dev(as_native=as_native) >>> print(y) { a:cpu, b:cpu }