is_ivy_array#

ivy.is_ivy_array(x, /, *, exclusive=False)[source]#

Determine whether the input x is a valid Ivy Array.

Parameters:
  • x (Union[Array, NativeArray]) – The input to check

  • exclusive (Optional[bool], default: False) – Whether to check if the data type is exclusively an array, rather than a variable or traced array.

Return type:

bool

Returns:

ret – Boolean, whether or not x is a valid Ivy Array.

Examples

>>> x = ivy.array([0, 1, 2])
>>> ivy.is_ivy_array(x)
True
>>> x = ivy.native_array([9.1, -8.3, 2.8, 3.0])
>>> ivy.is_ivy_array(x, exclusive=True)
False
Array.is_ivy_array(self, /, *, exclusive=False)[source]#

ivy.Array instance method variant of ivy.is_ivy_array. This method simply wraps the function, and so the docstring for ivy.is_ivy_array also applies to this method with minimal changes.

Parameters:
  • self (Array) – input array

  • exclusive (bool, default: False) – Whether to check if the data type is exclusively an array, rather than a variable or traced array.

Return type:

bool

Returns:

ret – Boolean, whether or not x is an ivy array.

Examples

>>> x = ivy.array([0, 1, 2])
>>> ret = x.is_ivy_array()
>>> print(ret)
True
Container.is_ivy_array(self, /, *, exclusive=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#

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 check

  • exclusive (Union[bool, Container], default: False) – Whether to check if the data type is exclusively an array, rather than a variable or traced array.

  • key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.

  • to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default is True.

  • prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied. Default is False.

  • map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples). Default is False.

Return type:

Container

Returns:

  • ret – Boolean, whether or not x is an array.

  • >>> x = ivy.Container(a=ivy.array([1]), b=ivy.native_array([2, 3]))

  • >>> y = x.is_ivy_array()

  • >>> print(y)

  • { – a: True, b: False

  • }