exists#
- ivy.exists(x)[source]#
Check as to whether the input is None or not.
- Parameters:
x (
Any
) – Input to check.- Return type:
bool
- Returns:
ret – True if x is not None, else False.
Examples
With
Any
input:>>> x = None >>> y = ivy.exists(x) >>> print(y) False
>>> x = "" >>> y = ivy.exists(x) >>> print(y) True
>>> x = [] >>> y = ivy.exists(x) >>> print(y) True
>>> x = 1 >>> y = ivy.exists(x) >>> print(y) True
>>> x = "abc" >>> y = ivy.exists(x) >>> print(y) True
>>> x = [1, 0, -1, 1] >>> y = ivy.exists(x) >>> print(y) True
>>> x = ivy.array([1, 2, 3, 1.2]) >>> y = ivy.exists(x) >>> print(y) True
With a mix of
ivy.Container
andAny
input:>>> x = ivy.Container(a=None, b=None) >>> y = ivy.exists(x) >>> print(y) True
>>> x = ivy.Container(a=None, b="") >>> y = ivy.exists(x) >>> print(y) True
>>> x = ivy.Container(a=123, b="") >>> y = ivy.exists(x) >>> print(y) True
- Array.exists(self)#
ivy.Array instance method variant of ivy.exists. This method simply wraps the function, and so the docstring for ivy.exists also applies to this method with minimal changes.
- Parameters:
self (
Array
) – input array.- Return type:
bool
- Returns:
ret – True if x is not None, else False.
Examples
>>> x = ivy.array([1, 2, 3, 1.2]) >>> y = x.exists() >>> print(y) True
>>> x = ivy.array(None) >>> y = x.exists() >>> print(y) True