is_array#
- ivy.is_array(x, /, *, exclusive=False)[source]#
Determine whether the input x is either an Ivy Array or a Native Array.
- Parameters:
x (
Any
) – 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 array.
Examples
>>> x = ivy.array([0, 1, 2]) >>> print(ivy.is_array(x)) True
>>> x = ivy.native_array([9.1, -8.3, 2.8, 3.0]) >>> print(ivy.is_array(x, exclusive=True)) True
>>> x = [2, 3] >>> print(ivy.is_array(x)) False
- Array.is_array(self, /, *, exclusive=False)#
ivy.Array instance method variant of ivy.is_array. This method simply wraps the function, and so the docstring for ivy.is_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:
bool
- Returns:
ret – Boolean, whether or not x is an array.
Examples
>>> x = ivy.array([0, 1, 2]) >>> print(x.is_array()) True
>>> x = ivy.native_array([9.1, -8.3, 2.8, 3.0]) >>> print(x.is_array(exclusive=True)) True
- Container.is_array(self, /, *, exclusive=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)#
ivy.Container instance method variant of ivy.is_array. This method simply wraps the function, and so the docstring for ivy.is_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 an array.
Examples
>>> x = ivy.Container(a=ivy.array([1]), b=ivy.native_array([2, 3])) >>> y = x.is_array() >>> print(y) { a: true, b: true }