# logit¶

paddle. logit ( x, eps=None, name=None ) [source]

This function generates a new tensor with the logit of the elements of input x. x is clamped to [eps, 1-eps] when eps is not zero. When eps is zero and x < 0 or x > 1, the function will yields NaN.

$logit(x) = ln(\frac{x}{1 - x})$

where

$\begin{split}x_i= \left\{\begin{array}{rcl} x_i & &\text{if } eps == Default \\ eps & &\text{if } x_i < eps \\ x_i & &\text{if } eps <= x_i <= 1-eps \\ 1-eps & &\text{if } x_i > 1-eps \end{array}\right.\end{split}$
Parameters
• x (Tensor) – The input Tensor with data type float32, float64.

• eps (float, optional) – the epsilon for input clamp bound. Default is None.

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

Returns

A Tensor with the same data type and shape as x .

Return type

out(Tensor)

Examples

import paddle

x = paddle.to_tensor([0.2635, 0.0106, 0.2780, 0.2097, 0.8095])