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

PyTorch torch.sigmoid function

PyTorch torch.sigmoid function


PyTorch torch reference manual 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

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual