# logit#

ivy.logit(x, /, *, eps=None, out=None)[source]#

Compute the logit of x.

logit(x) = log(x / (1 - x)).

Parameters:
• x (`Union`[`float`, `int`, `Array`]) – Input data.

• eps (`Optional`[`float`]) – When eps is None the function outpus NaN where x < 0 or x > 1. (default: `None`) and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps]

• out (`Optional`[`Array`]) – Optional output array. (default: `None`)

Return type:

`Array`

Returns:

ret – Array containing elementwise logits of x.

Examples

```>>> x = ivy.array([1, 0, 0.9])
>>> z = ivy.logit(x)
>>> print(z)
ivy.array([       inf,       -inf, 2.19722438])
```
```>>> x = ivy.array([1, 2, -0.9])
>>> z = ivy.logit(x, eps=0.2)
>>> print(z)
ivy.array([ 1.38629448,  1.38629448, -1.38629436])
```
Array.logit(self, /, *, eps=None, out=None)#

ivy.Array instance method variant of ivy.logit. This method simply wraps the function, and so the docstring for ivy.logit also applies to this method with minimal changes.

Parameters:
• self – Input array.

• eps (`Optional`[`float`]) – When eps is None the function outpus NaN where x < 0 or x > 1. (default: `None`) and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps]

• out (`Optional`[`Array`]) – Optional output array. (default: `None`)

Return type:

`Array`

Returns:

ret – Array containing elementwise logits of x.

Examples

```>>> x = ivy.array([1, 0, 0.9])
>>> z = x.logit()
>>> print(z)
ivy.array([       inf,       -inf, 2.19722438])
```
```>>> x = ivy.array([1, 2, -0.9])
>>> z = x.logit(eps=0.2)
>>> print(z)
ivy.array([ 1.38629448,  1.38629448, -1.38629436])
```
Container.logit(self, /, *, eps=None, out=None)#

ivy.Container instance method variant of ivy.logit. This method simply wraps the function, and so the docstring for ivy.logit also applies to this method with minimal changes.

Parameters:
• self (`Union`[`float`, `int`, `Container`]) – Input container.

• eps (`Optional`[`float`]) – When eps is None the function outpus NaN where x < 0 or x > 1. (default: `None`) and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps]

• out (`Optional`[`Container`]) – Optional output Contaner. (default: `None`)

Return type:

`Container`

Returns:

ret – Container with logits of the leaves.

Examples

```>>> a = ivy.array([1, 0, 0.9])
>>> b = ivy.array([0.1, 2, -0.9])
>>> x = ivy.Container(a=a, b=b)
>>> z = x.logit()
>>> print(z)
{
a: ivy.array([inf, -inf, 2.19722438]),
b: ivy.array([-2.19722462, nan, nan])
}
```
```>>> a = ivy.array([0.3, 2, 0.9])
>>> b = ivy.array([0.1, 1.2, -0.9])
>>> x = ivy.Container(a=a, b=b)
>>> z = x.logit(eps=0.2)
>>> print(z)
{
a: ivy.array([-0.84729779, 1.38629448, 1.38629448]),
b: ivy.array([-1.38629436, 1.38629448, -1.38629436])
}
```