default_float_dtype#
- ivy.default_float_dtype(*, input=None, float_dtype=None, as_native=False)[source]#
- Parameters:
input (
Optional
[Union
[Array
,NativeArray
]]) – Number or array for inferring the float dtype. (default:None
)float_dtype (
Optional
[Union
[FloatDtype
,NativeDtype
]]) – The float dtype to be returned. (default:None
)as_native (
bool
) – Whether to return the float dtype as native dtype. (default:False
)
- Return type:
Union
[Dtype
,str
,NativeDtype
]- Returns:
Return
float_dtype
as native or ivy dtype if provided, elseif
input
is given, return its float dtype, otherwise return theglobal 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'