50% off: Unlimited data and AI learning.
The Learning Leader's Guide to AI Literacy

torch (version 0.8.1)

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.

yi=ln(zi1zi)zi=xiif eps is Noneepsif xi<epsxiif epsxi1eps1epsif xi>1eps

Examples

Run this code
if (torch_is_installed()) {

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

Run the code above in your browser using DataLab