giagrad.Tensor.sigmoid#

Tensor.sigmoid() Tensor[source]#

Returns a new Tensor with element-wise sigmoid function. See sigmoid.

For numerical stability sigmoid function is computed with numpy.logaddexp.

\[out_i = \frac{1}{(1 + \exp(-data_i))}\]

Examples

>>> t = Tensor.empty(2, 3).uniform(-100, 100)
>>> t
tensor: [[-49.970577  35.522175 -14.944364]
         [ 32.187164 -66.65264   48.01228 ]]
>>> t.sigmoid()
tensor: [[1.9863422e-22 1.0000000e+00 3.2340398e-07]
         [1.0000000e+00 1.1301229e-29 1.0000000e+00]] fn: Sigmoid