Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.logit function

PyTorch torch.logit function


PyTorch torch reference manual PyTorch torch reference manual

torch.logit is a function in PyTorch used to compute the logit function, that is, log(p / (1-p)).

Function definition

torch.logit(input, eps=None, out=None)


Usage examples

Example

import

torch

Compute the logit

x

=

torch.

tensor

(

[

0.1

,

0.3

,

0.5

,

0.7

,

0.9

]

)

y

=

torch.

logit

(

x

)

print

(

"logit:"

,

y

)

The output is:

logit: tensor([-2.1972, -0.8473,  0.0000,  0.8473,  2.1972])


PyTorch torch reference manual PyTorch torch reference manual