remainder( x, y, name=None )
Mod two tensors element-wise. The equation is:\[out = x \% y\]
paddle.remaindersupports broadcasting. If you want know more about broadcasting, please refer to Broadcasting .
x (Tensor) – the input tensor, it’s data type should be float32, float64, int32, int64.
y (Tensor) – the input tensor, it’s data type should be float32, float64, int32, int64.
name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
N-D Tensor. A location into which the result is stored. If x, y have different shapes and are “broadcastable”, the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape, its shape is the same as x and y.
import paddle x = paddle.to_tensor([2, 3, 8, 7]) y = paddle.to_tensor([1, 5, 3, 3]) z = paddle.remainder(x, y) print(z) # [0, 3, 2, 1]