is_float_dtype#

ivy.is_float_dtype(dtype_in, /)[source]#

Determine whether the input data type is a float dtype.

Parameters:

dtype_in (Union[Dtype, str, Array, NativeArray, Number]) – The array or data type to check

Return type:

bool

Returns:

ret – Whether or not the array or data type is of a floating point dtype

Examples

>>> x = ivy.is_float_dtype(ivy.float32)
>>> print(x)
True
>>> arr = ivy.array([1.2, 3.2, 4.3], dtype=ivy.float32)
>>> print(ivy.is_float_dtype(arr))
True
Array.is_float_dtype(self)[source]#

ivy.Array instance method variant of ivy.is_float_dtype. This method simply checks to see if the array is of type float.

Parameters:

self (Array) – Input array from which to check for float dtype.

Return type:

bool

Returns:

ret – Boolean value of whether the array is of type float.

Examples

>>> x = ivy.array([1, 2, 3], dtype=ivy.int8)
>>> print(x.is_float_dtype())
False
>>> x = ivy.array([2.3, 4.5, 6.8], dtype=ivy.float32)
>>> print( x.is_float_dtype())
True
Container.is_float_dtype(self, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#

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

Parameters:
  • self (ivy.Container) – The ivy.Container instance to call ivy.is_float_dtype on.

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

  • to_apply (bool) – Boolean indicating whether to apply the method to the key-chains. Default is False.

  • prune_unapplied (bool) – Boolean indicating whether to prune the key-chains that were not applied. Default is False.

  • map_sequences (bool) – Boolean indicating whether to map method to sequences (list, tuple). Default is False.

Return type:

Container

Returns:

ret (bool) – Boolean of whether the input is of a float dtype.

Examples

>>> x = ivy.is_float_dtype(ivy.float32)
>>> print(x)
True
>>> x = ivy.is_float_dtype(ivy.int64)
>>> print(x)
False
>>> x = ivy.is_float_dtype(ivy.int32)
>>> print(x)
False
>>> x = ivy.is_float_dtype(ivy.bool)
>>> print(x)
False
>>> arr = ivy.array([1.2, 3.2, 4.3], dtype=ivy.float32)
>>> print(arr.is_float_dtype())
True
>>> x = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([3, 4, 5]))
>>> print(x.a.dtype, x.b.dtype)
float32 int32