Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

torch_logit

Logit


Description

Logit

Usage

torch_logit(self, eps = NULL)

Arguments

self

(Tensor) the input tensor.

eps

(float, optional) the epsilon for input clamp bound. Default: None

logit(input, eps=None, *, out=None) -> Tensor

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

y_{i} = \ln(\frac{z_{i}}{1 - z_{i}}) \\ z_{i} = \begin{array}{ll} x_{i} & \mbox{if eps is None} \\ \mbox{eps} & \mbox{if } x_{i} < \mbox{eps} \\ x_{i} & \mbox{if } \mbox{eps} ≤q x_{i} ≤q 1 - \mbox{eps} \\ 1 - \mbox{eps} & \mbox{if } x_{i} > 1 - \mbox{eps} \end{array}

Examples

if (torch_is_installed()) {

a <- torch_rand(5)
a
torch_logit(a, eps=1e-6)
}

torch

Tensors and Neural Networks with 'GPU' Acceleration

v0.3.0
MIT + file LICENSE
Authors
Daniel Falbel [aut, cre, cph], Javier Luraschi [aut], Dmitriy Selivanov [ctb], Athos Damiani [ctb], Christophe Regouby [ctb], Krzysztof Joachimiak [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.