mindspore.numpy.promote_types
- mindspore.numpy.promote_types(type1, type2)[source]
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-bit
over64-bit
data 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.dtype
input.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> output = np.promote_types(np.float32, np.float64) >>> print(output) Float64