mindspore.numpy.result_type
- mindspore.numpy.result_type(*arrays_and_dtypes)[source]
Returns the type that results from applying the type promotion rules to the arguments.
Note
The promotion rule is slightly different from original Numpy, but more like jax, due to the preference on
32-bit
over64-bit
data types. Complex dtypes are not supported.- Parameters
*arrays_and_dtypes (Union[int, float, bool, list, tuple, Tensor,
mindspore.dtype
, str]) – The operands of some operation whose result type is needed.- Returns
mindspore.dtype
, the result type.- Raises
TypeError – If the input is not a valid data type.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> print(np.result_type('i2', np.float32, True)) Float32