default_float_dtype#
- ivy.default_float_dtype(*, input=None, float_dtype=None, as_native=False)[source]#
- Parameters:
input (
Optional
[Union
[Array
,NativeArray
]], default:None
) – Number or array for inferring the float dtype.float_dtype (
Optional
[Union
[FloatDtype
,NativeDtype
]], default:None
) – The float dtype to be returned.as_native (
bool
, default:False
) – Whether to return the float dtype as native dtype.
- Return type:
Union
[Dtype
,str
,NativeDtype
]- Returns:
Return
float_dtype
as native or ivy dtype if provided, else ifinput
is given, return its float dtype, otherwise return the global default float dtype.
Examples
>>> ivy.default_float_dtype() 'float32'
>>> ivy.set_default_float_dtype(ivy.FloatDtype("float64")) >>> ivy.default_float_dtype() 'float64'
>>> ivy.default_float_dtype(float_dtype=ivy.FloatDtype("float16")) 'float16'
>>> ivy.default_float_dtype(input=4294.967346) 'float32'
>>> x = ivy.array([9.8,8.9], dtype="float16") >>> ivy.default_float_dtype(input=x) 'float16'