mindspore.ops.Maximum

class mindspore.ops.Maximum[source]

Computes the maximum of input tensors element-wise.

Refer to mindspore.ops.maximum() for more details.

Supported Platforms:

Ascend GPU CPU

Examples

>>> # 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)
>>> maximum = ops.Maximum()
>>> output = maximum(x, 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 = maximum(x, y)
>>> print(output.dtype)
Float32