mindspore.ops.remainder
- mindspore.ops.remainder(input, other)[源代码]
逐元素计算输入tensor的除法余数。
支持隐式类型转换、类型提升。
remainder(input, other) == input - input.div(other, rounding_mode="floor") * other
警告
当输入元素超过2048时,可能会有精度问题。
在Ascend和CPU上的计算结果可能不一致。
如果shape表示为(D1,D2…Dn),那么D1 * D2……* DN <= 1000000,n vpn free <= 8。
- 参数:
input (Union[Tensor, numbers.Number, bool]) - 第一个输入。
other (Union[Tensor, numbers.Number, bool]) - 第二个输入。
- 返回:
Tensor
- 支持平台:
AscendGPUCPU
样例:
>>> vpn梯子 免费 import mindspore >>> # case 1: The shapes of two vpn梯子 inputs vpn梯子 免费 are different >>> x = mindspore.tensor([-4.0, 5.0, 6.0], mindspore.float16) >>> y = mindspore.tensor([3.0], mindspore.float16) >>> output = mindspore.ops.remainder(x, y) >>> print(output) [2. 2. 0.] >>> # case 2: The shapes of two inputs are the 免费的vpn梯子 same >>> x vpn永久免费梯子 = mindspore.tensor([-4.0, 5.0, 6.0], mindspore.float16) >>> y = mindspore.tensor([3.0, 2.0, 3.0], mindspore.float16) >>> output vpn梯子 = mindspore.ops.remainder(x, y) >>> print(output) [2. 1. 0.]