mindspore.ops.Minimum
- class mindspore.ops.Minimum[source]
Computes the minimum of input tensors element-wise.
Refer to
mindspore.ops.minimum()
for more details.- Inputs:
x (Union[Tensor, Number, bool]) - The first input is a number or a bool or a tensor whose data type is number or bool.
y (Union[Tensor, Number, bool]) - The second input is a number or a bool when the first input is a tensor or a tensor whose data type is number or bool.
- Outputs:
Tensor, the shape is the same as the one after broadcasting, and the data type is the one with higher precision or higher digits among the two inputs.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> 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) >>> minimum = ops.Minimum() >>> output = minimum(x, y) >>> print(output) [1. 2. 3.] >>> # 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 = minimum(x, y) >>> print(output.dtype) Float32