is_native_array#
- ivy.is_native_array(x, /, *, exclusive=False)[source]#
Determine whether the input x is an
ivy.NativeArray
instance.- Parameters:
x (
Union
[Array
,NativeArray
]) – The input to checkexclusive (
bool
) – Whether to check if the data type is exclusively an array, rather than a (default:False
) variable or traced array.
- Return type:
bool
- Returns:
ret – Boolean, whether or not x is an
ivy.NativeArray
.
Examples
>>> x = ivy.array([0, 1, 2]) >>> ivy.is_native_array(x) False
>>> x = ivy.native_array([9.1, -8.3, 2.8, 3.0]) >>> ivy.is_native_array(x, exclusive=True) True
- Array.is_native_array(self, /, *, exclusive=False)#
ivy.Array instance method variant of ivy.is_native_array. This method simply wraps the function, and so the docstring for ivy.is_native_array also applies to this method with minimal changes.
- Parameters:
self (
Array
) – The input to checkexclusive (
bool
) – Whether to check if the data type is exclusively an array, rather than a (default:False
) variable or traced array.
- Return type:
Array
- Returns:
ret – Boolean, whether or not x is a native array.
Examples
>>> x = ivy.array([0, 1, 2]) >>> ret = x.is_native_array() >>> print(ret) False
>>> x = ivy.native_array([9.1, -8.3]) >>> ret = x.is_native_array(exclusive=True) >>> print(ret) True
- Container.is_native_array(self, /, *, exclusive=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)#
ivy.Container instance method variant of ivy.is_native_array. This method simply wraps the function, and so the docstring for ivy.ivy.is_native_array also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The input to checkexclusive (
bool
) – Whether to check if the data type is exclusively an array, rather than a (default:False
) variable or traced array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.
- Return type:
Container
- Returns:
ret – Boolean, whether or not x is a native array.
Examples
>>> x = ivy.Container(a=ivy.array([1]), b=ivy.native_array([2, 3])) >>> y = x.is_native_array() >>> print(y) { a: false, b: true }