infer_default_dtype#

ivy.infer_default_dtype(dtype, as_native=False)[source]#

Summary.

Parameters:
  • dtype (Union[Dtype, NativeDtype, str]) –

  • as_native (bool, default: False) – (Default value = False)

Return type:

Union[Dtype, NativeDtype]

Returns:

Return the default data type for the “kind” (integer or floating-point) of dtype

Examples

>>> ivy.set_default_int_dtype("int32")
>>> ivy.infer_default_dtype("int8")
'int8'
>>> ivy.set_default_float_dtype("float64")
>>> ivy.infer_default_dtype("float32")
'float64'
>>> ivy.set_default_uint_dtype("uint32")
>>> x = ivy.array([0], dtype="uint64")
>>> ivy.infer_default_dtype(x.dtype)
'uint32'