mindspore.ops.subtract
- mindspore.ops.subtract(input, other, *, alpha=1)[source]
Performs the element-wise subtract of input tensors.
\[output[i] = input[i] - alpha * other[i]\]- Parameters
- Keyword Arguments
alpha (Number) – The multiplier for other. Default: 1.
- Returns
Tensor, has the same shape and dtype as input tensors.
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input = Tensor(np.array([4, 5, 6]), mindspore.float32) >>> y = Tensor(np.array([1, 2, 3]), mindspore.float32) >>> z = ops.subtract(input, y, alpha=1) >>> print(z) [3. 3. 3.]