PyTorch torch.sigmoid function
PyTorch torch reference manual
torch.sigmoid is a function in PyTorch used to compute the element-wise sigmoid function. The sigmoid function is defined as 1/(1+exp(-x)).
Function definition
torch.sigmoid(input, out=None)
Usage examples
Example
import
torch
Compute the sigmoid function
x
=
torch.
tensor
(
[
0.0
,
1.0
,
1.0
]
)
result
=
torch.
sigmoid
(
x
)
(
result
)