mindspore.numpy.result_type

mindspore.numpy.result_type(*arrays_and_dtypes)[源代码]

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

说明

The promotion rule is slightly different from original Numpy, but more like jax, due to the preference on 32-bit over 64-bit data types. Complex dtypes are not supported.

参数

*arrays_and_dtypes (Union[int, float, bool, list, tuple, Tensor, mindspore.dtype, str]) – The operands of some operation whose result type is needed.

返回

mindspore.dtype, the result type.

异常

TypeError – If the input is not a valid data type.

Supported Platforms:

Ascend GPU CPU

样例

>>> import mindspore.numpy as np
>>> print(np.result_type('i2', np.float32, True))
Float32