positive¶
- paddle. positive ( x: Tensor, name: str | None = None ) Tensor [source]
-
Returns the input Tensor as it is. This is used in Tensor.__pos__, applying the unary + operator to the tensor.
Out=+X- Parameters
-
x (Tensor) – The input tensor. The tensor cannot be of type bool.
name (str|None, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
- Returns
-
- A tensor with the same shape and data type as the input tensor. The returned tensor
-
is the same.
- Return type
-
Tensor
Examples
>>> import paddle >>> x = paddle.to_tensor([-1, 0, 1]) >>> out = paddle.positive(x) >>> print(out) Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True, [-1, 0, 1])