PyTorch
torch / torch
torch.logit¶
-
torch.
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 andinput
< 0 orinput
> 1, the function will yields NaN.yi=ln(1−zizi)zi=⎩⎪⎪⎪⎪⎨⎪⎪⎪⎪⎧xiepsxi1−epsif eps is Noneif xi<epsif eps≤xi≤1−epsif xi>1−eps- Parameters
- Keyword Arguments
out (Tensor, optional) – the output tensor.
Example:
>>> a = torch.rand(5) >>> a tensor([0.2796, 0.9331, 0.6486, 0.1523, 0.6516]) >>> torch.logit(a, eps=1e-6) tensor([-0.9466, 2.6352, 0.6131, -1.7169, 0.6261])
此页内容是否对您有帮助
感谢反馈!