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.- 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])