mindspore.numpy.promote_types
- mindspore.numpy.promote_types(type1, type2)[源代码]
Returns the data type with the smallest size and smallest scalar kind.
Note
The promotion rule is slightly different from original Numpy, but more like jax, due to the preference on
32-bitover64-bitdata types.- Parameters
type1 (Union[
mindspore.dtype, str]) – First data type.type2 (Union[
mindspore.dtype, str]) – Second data type.
- Returns
The promoted data type.
- Raises
TypeError – If the input are not valid
mindspore.dtypeinput.
- Supported Platforms:
AscendGPUCPU
Examples
>>> import mindspore.numpy as np >>> output = np.promote_types(np.float32, np.float64) >>> print(output) Float64