Floor divide two tensors element-wise and rounds the quotinents to the nearest integer toward negative infinite. The equation is: .. math:: out = floor(x / y) - :math:`x`: Multidimensional Tensor. - :math:`y`: Multidimensional Tensor. Note: ``paddle.floor_divi
(
x: Tensor,
y: Number | Tensor,
name: str | None = None,
*,
out: Tensor | None = None,
)
| 1161 | |
| 1162 | @param_two_alias(['x', 'input'], ['y', 'other']) |
| 1163 | def floor_divide( |
| 1164 | x: Tensor, |
| 1165 | y: Number | Tensor, |
| 1166 | name: str | None = None, |
| 1167 | *, |
| 1168 | out: Tensor | None = None, |
| 1169 | ) -> Tensor: |
| 1170 | """ |
| 1171 | Floor divide two tensors element-wise and rounds the quotinents to the nearest integer toward negative infinite. The equation is: |
| 1172 | |
| 1173 | .. math:: |
| 1174 | out = floor(x / y) |
| 1175 | |
| 1176 | - :math:`x`: Multidimensional Tensor. |
| 1177 | - :math:`y`: Multidimensional Tensor. |
| 1178 | |
| 1179 | Note: |
| 1180 | ``paddle.floor_divide`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ . |
| 1181 | |
| 1182 | .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor |
| 1183 | |
| 1184 | |
| 1185 | Args: |
| 1186 | x (Tensor): the input tensor, it's data type should be uint8, int8, int32, int64, float32, float64, float16, bfloat16. |
| 1187 | alias: ``input``. |
| 1188 | y (Tensor|Number): the input tensor or number, it's data type should be uint8, int8, int32, int64, float32, float64, float16, bfloat16. |
| 1189 | alias: ``other``. |
| 1190 | name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`. |
| 1191 | |
| 1192 | Keyword Args: |
| 1193 | out (Tensor|None, optional): The output tensor. Default: None. |
| 1194 | |
| 1195 | Returns: |
| 1196 | N-D Tensor. A location into which the result is stored. It's dimension equals with $x$. |
| 1197 | |
| 1198 | Examples: |
| 1199 | |
| 1200 | .. code-block:: pycon |
| 1201 | |
| 1202 | >>> import paddle |
| 1203 | |
| 1204 | >>> x = paddle.to_tensor([2, 3, 8, 7]) |
| 1205 | >>> y = paddle.to_tensor([1, 5, 3, 3]) |
| 1206 | >>> z = paddle.floor_divide(x, y) |
| 1207 | >>> print(z) |
| 1208 | Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True, |
| 1209 | [2, 0, 2, 2]) |
| 1210 | |
| 1211 | >>> x = paddle.to_tensor([2, 3, 8, 7]) |
| 1212 | >>> y = paddle.to_tensor([1, -5, -3, -3]) |
| 1213 | >>> z = paddle.floor_divide(x=x, y=y) |
| 1214 | >>> print(z) |
| 1215 | Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True, |
| 1216 | [2, -1, -3, -3]) |
| 1217 | |
| 1218 | >>> x = paddle.to_tensor([2, -3, 8, -7]) |
| 1219 | >>> y = paddle.to_tensor([1, -5, -3, 3]) |
| 1220 | >>> z = paddle.floor_divide(input=x, other=y) # type: ignore[call-arg] |
nothing calls this directly
no test coverage detected