API

 torch / torch


torch.sigmoid

torch.sigmoid(input, *, out=None) → Tensor

Returns a new tensor with the sigmoid of the elements of input.

outi=11+einputi\text{out}_{i} = \frac{1}{1 + e^{-\text{input}_{i}}}
Parameters

input (Tensor) – the input tensor.

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example:

>>> a = torch.randn(4)
>>> a
tensor([ 0.9213,  1.0887, -0.8858, -1.7683])
>>> torch.sigmoid(a)
tensor([ 0.7153,  0.7481,  0.2920,  0.1458])

此页内容是否对您有帮助