iinfo#

ivy.iinfo(type, /)[source]#

Machine limits for integer data types.

Parameters:

type (Union[Dtype, str, Array, NativeArray]) – the kind of integer data-type about which to get information.

Return type:

None

Returns:

ret – a class with that encapsules the following attributes:

  • bits: int

number of bits occupied by the type.

  • max: int

largest representable number.

  • min: int

smallest representable number.

This function conforms to the Array API Standard. This docstring is an extension of the docstring in the standard.

Examples

With ivy.Dtype input:

>>> ivy.iinfo(ivy.int32)
iinfo(min=-2147483648, max=2147483647, dtype=int32)

With str input:

>>> ivy.iinfo('int32')
iinfo(min=-2147483648, max=2147483647, dtype=int32)

With ivy.Array input:

>>> x = ivy.array([13,21,34], dtype=ivy.int8)
>>> ivy.iinfo(x)
iinfo(min=-128, max=127, dtype=int8)

With ivy.NativeArray input:

>>> x = ivy.native_array([7,84,314], dtype=ivy.int64)
>>> ivy.iinfo(x)
iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64)

With ivy.Container input:

>>> c = ivy.Container(x=ivy.array([0,1800,89], dtype=ivy.uint16),
...                   y=ivy.array([76,81,16], dtype=ivy.uint32))
>>> ivy.iinfo(c)
{
    x: iinfo(min=0, max=65535, dtype=uint16),
    y: iinfo(min=0, max=4294967295, dtype=uint32)
}
Array.iinfo(self, /)[source]#

ivy.Array instance method variant of ivy.iinfo. This method simply wraps the function, and so the docstring for ivy.iinfo also applies to this method with minimal changes.

Parameters:

self (Array) – input array.

Return type:

None

Returns:

ret – An instance of the Iinfo class, containing information about the integer data type of the input array.

Examples

>>> x = ivy.array([-119,122,14], dtype=ivy.int8))
>>> x.iinfo()
iinfo(min=-128, max=127, dtype=int8)
>>> x = ivy.array([-12,54,1,9,-1220], dtype=ivy.int16))
>>> x.iinfo()
iinfo(min=-32768, max=32767, dtype=int16)
Container.iinfo(self, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#

ivy.Container instance method variant of ivy.iinfo. This method simply wraps the function, and so the docstring for ivy.iinfo also applies to this method with minimal changes.

Parameters:
  • self (Container) – input container with leaves to inquire information about.

  • key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.

  • to_apply (Union[bool, Container], default: True) – Boolean indicating whether to apply the method to the key-chains. Default is True.

  • prune_unapplied (Union[bool, Container], default: False) – Boolean indicating whether to prune the key-chains that were not applied. Default is False.

  • map_sequences (Union[bool, Container], default: False) – Boolean indicating whether to map method to sequences (list, tuple). Default is False.

Return type:

Container

Returns:

ret – container of the same structure as self, with each element as an iinfo object for the corresponding dtype of leave in`self`.

Examples

>>> c = ivy.Container(x=ivy.array([-9,1800,89], dtype=ivy.int16),
...                   y=ivy.array([76,-81,16], dtype=ivy.int32))
>>> c.iinfo()
{
    x: iinfo(min=-32768, max=32767, dtype=int16),
    y: iinfo(min=-2147483648, max=2147483647, dtype=int32)
}
>>> c = ivy.Container(x=ivy.array([-12,123,4], dtype=ivy.int8),
...                   y=ivy.array([76,-81,16], dtype=ivy.int16))
>>> c.iinfo()
{
    x: iinfo(min=-128, max=127, dtype=int8),
    y: iinfo(min=-32768, max=32767, dtype=int16)
}