mxnet.numpy.type_functions

Type functions for the numpy module.

Functions

can_cast(from_, to)

Returns True if cast between data types can occur according to the casting rule.

finfo(dtype)

Machine limits for floating-point data types.

iinfo(dtype)

Machine limits for floating-point data types.

result_type(*arrays_and_dtypes)

Returns the dtype that results from applying the type promotion rules to the arguments.

Classes

finfo_obj(bits, eps, max, min, smallest_normal)

iinfo_obj(bits, max, min)

mxnet.numpy.type_functions.can_cast(from_, to)[source]

Returns True if cast between data types can occur according to the casting rule. If from is a scalar or array scalar, also returns True if the scalar value can be cast without overflow or truncation to an integer.

Parameters:
  • from (dtype, ndarray or scalar) – Data type, scalar, or array to cast from.

  • to (dtype) – Data type to cast to.

Returns:

out – True if cast can occur according to the casting rule.

Return type:

bool

mxnet.numpy.type_functions.finfo(dtype)[source]

Machine limits for floating-point data types.

Notes

finfo is a standard API in https://data-apis.org/array-api/latest/API_specification/data_type_functions.html#finfo-type instead of an official NumPy operator.

Parameters:

dtype (ndarray, float or dtype) – Kind of floating point data-type about which to get information.

Returns:

out

an object having the following attributes:
  • bitsint

    number of bits occupied by the floating-point data type.

  • epsfloat

    difference between 1.0 and the next smallest representable floating-point number larger than 1.0 according to the IEEE-754 standard.

  • maxfloat

    largest representable number.

  • minfloat

    smallest representable number.

  • smallest_normalfloat

    smallest positive floating-point number with full precision.

Return type:

finfo object

mxnet.numpy.type_functions.iinfo(dtype)[source]

Machine limits for floating-point data types.

Notes

iinfo is a standard API in https://data-apis.org/array-api/latest/API_specification/data_type_functions.html#iinfo-type instead of an official NumPy operator.

Parameters:

dtype (ndarray, integer or dtype) – The kind of integer data type to get information about.

Returns:

out

an object having the following attributes:
  • bitsint

    number of bits occupied by the type

  • maxint

    largest representable number.

  • minint

    smallest representable number.

Return type:

iinfo object

mxnet.numpy.type_functions.result_type(*arrays_and_dtypes)[source]

Returns the dtype that results from applying the type promotion rules to the arguments.

Notes

result_type is a standard API in https://data-apis.org/array-api/latest/API_specification/data_type_functions.html#result-type-arrays-and-dtypes instead of an official NumPy operator.

Parameters:

arrays_and_dtypes (mixed ndarrays and dtypes) – an arbitrary number of input arrays and/or dtypes.

Returns:

out – the dtype resulting from an operation involving the input arrays and dtypes.

Return type:

dtype