floor_mod

paddle. floor_mod ( x: Tensor, y: Tensor, name: str | None = None, *, out: Tensor | None = None ) Tensor [source]

Mod two tensors element-wise. The equation is:

\[out = x \% y\]

Note

Alias Support: The parameter name input can be used as an alias for x, and other can be used as an alias for y.

Note

paddle.remainder supports broadcasting. If you want know more about broadcasting, please refer to Introduction to Tensor .

And mod, floor_mod are all functions with the same name

Parameters
  • x (Tensor) – the input tensor, it’s data type should be bfloat16, float16, float32, float64, int32, int64.

  • y (Tensor) – the input tensor, it’s data type should be bfloat16, float16, float32, float64, int32, int64.

  • name (str|None, optional) – Name for the operation (optional, default is None). For more information, please refer to api_guide_Name.

  • out (Tensor|None, optional) – The output tensor. If set, the result will be stored in this tensor. Default is None.

Returns

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.

Examples

>>> 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)
Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
[0, 3, 2, 1])

>>> z = paddle.floor_mod(x, y)
>>> print(z)
Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
[0, 3, 2, 1])

>>> z = paddle.mod(x, y)
>>> print(z)
Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
[0, 3, 2, 1])