round_
- paddle.Tensor. round_ ( x: Tensor, decimals: int = 0, name: str | None = None ) Tensor
-
Inplace version of
roundAPI, output Tensor will be inplaced with inputx. Please refer to round.- Parameters
-
x (Tensor) – Input of Round operator, an N-D Tensor, with data type bfloat16, int32, int64, float32, float64, float16, complex64 or complex128. Alias:
input.decimals (int) – Rounded decimal place (default: 0).
name (str|None, optional) – Name for the operation (optional, default is None). For more information, please refer to api_guide_Name.
- Returns
-
Tensor. Output of Round operator, same as input
x.
Examples
>>> import paddle >>> x = paddle.to_tensor([-0.5, -0.2, 0.6, 1.5]) >>> x.round_() >>> print(x) Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True, [-0., -0., 1., 2.])
