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)#
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) >>> x.is_float_dtype() False
- Container.is_float_dtype(self, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)#
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:
None
) Default isNone
.to_apply (bool) – Boolean indicating whether to apply the (default:
True
) method to the key-chains. Default isFalse
.prune_unapplied (bool) – Boolean indicating whether to prune the (default:
False
) key-chains that were not applied. Default isFalse
.map_sequences (bool) – Boolean indicating whether to map method (default:
False
) to sequences (list, tuple). Default isFalse
.
- 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