mindspore.numpy.promote_types
- mindspore.numpy.promote_types(type1, type2)[源代码]
Returns the data type with the smallest size and smallest scalar kind.
说明
The promotion rule is slightly different from original Numpy, but more like jax, due to the preference on
32-bit
over64-bit
data types.- 参数
type1 (Union[
mindspore.dtype
, str]) – First data type.type2 (Union[
mindspore.dtype
, str]) – Second data type.
- 返回
The promoted data type.
- 异常
TypeError – If the input are not valid
mindspore.dtype
input.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> output = np.promote_types(np.float32, np.float64) >>> print(output) Float64