dtype_bits#

ivy.dtype_bits(dtype_in, /)[source]#

Get the number of bits used for representing the input data type.

Parameters:

dtype_in (Union[Dtype, NativeDtype, str]) – The data type to determine the number of bits for.

Return type:

int

Returns:

ret – The number of bits used to represent the data type.

Examples

With ivy.Dtype inputs:

>>> x = ivy.dtype_bits(ivy.float32)
>>> print(x)
32
>>> x = ivy.dtype_bits('int64')
>>> print(x)
64

With ivy.NativeDtype inputs:

>>> x = ivy.dtype_bits(ivy.native_bool)
>>> print(x)
1