ivy.default_float_dtype(*, input=None, float_dtype=None, as_native=False)[source]#
  • 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]


Return float_dtype as native or ivy dtype if provided, else if input is given, return its float dtype, otherwise return the global default float dtype.


>>> ivy.default_float_dtype()
>>> ivy.set_default_float_dtype(ivy.FloatDtype("float64"))
>>> ivy.default_float_dtype()
>>> ivy.default_float_dtype(float_dtype=ivy.FloatDtype("float16"))
>>> ivy.default_float_dtype(input=4294.967346)
>>> x = ivy.array([9.8,8.9], dtype="float16")
>>> ivy.default_float_dtype(input=x)