PyTorch torch.logit Function
Pytorch torch Reference Manual
torch.logitIt is the function in PyTorch used to compute the logit function, i.e., log(p / (1-p)).
Function Definition
torch.logit(input, eps=None, out=None)
Usage Example
Example
import torch
# Compute logit
x = torch.tensor([0.1, 0.3, 0.5, 0.7, 0.9])
y = torch.logit(x)
print("logit:", y)
# Compute logit
x = torch.tensor([0.1, 0.3, 0.5, 0.7, 0.9])
y = torch.logit(x)
print("logit:", y)
The output result is:
logit: tensor([-2.1972, -0.8473, 0.0000, 0.8473, 2.1972])
Other Extensions