mindspore.Tensor.maximum
- mindspore.Tensor.maximum(other)
详情请参考
mindspore.ops.maximum()
。- 支持平台:
Ascend
GPU
CPU
样例:
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> # case 1 : same data type >>> x = Tensor(np.array([1.0, 5.0, 3.0]), mindspore.float32) >>> y = Tensor(np.array([4.0, 2.0, 6.0]), mindspore.float32) >>> output = x.maximum(y) >>> print(output) [4. 5. 6.] >>> # case 2 : different data type >>> x = Tensor(np.array([1.0, 5.0, 3.0]), mindspore.int32) >>> y = Tensor(np.array([4.0, 2.0, 6.0]), mindspore.float32) >>> output = x.maximum(y) >>> print(output.dtype) Float32