r"""Applies the element-wise function: .. math:: \text{logsigmoid}(x) = \log(\frac{ 1 }{ 1 + \exp(-x)}) = \log(1/(1 + \exp(-x))) = - \log(1 + \exp(-x)) = - \text{softplus}(-x) Examples: >>> import numpy as np >>> x = Tensor(np.arange(-5, 5, d
(inp: Tensor)
| 952 | |
| 953 | |
| 954 | def logsigmoid(inp: Tensor) -> Tensor: |
| 955 | r"""Applies the element-wise function: |
| 956 | |
| 957 | .. math:: |
| 958 | \text{logsigmoid}(x) = \log(\frac{ 1 }{ 1 + \exp(-x)}) |
| 959 | = \log(1/(1 + \exp(-x))) |
| 960 | = - \log(1 + \exp(-x)) |
| 961 | = - \text{softplus}(-x) |
| 962 | |
| 963 | Examples: |
| 964 | >>> import numpy as np |
| 965 | >>> x = Tensor(np.arange(-5, 5, dtype=np.float32)) |
| 966 | >>> y = F.logsigmoid(x) |
| 967 | >>> y.numpy().round(decimals=4) |
| 968 | array([-5.0067, -4.0182, -3.0486, -2.1269, -1.3133, -0.6931, -0.3133, |
| 969 | -0.1269, -0.0486, -0.0181], dtype=float32) |
| 970 | """ |
| 971 | return _elwise(inp, mode=Elemwise.Mode.LOGSIGMOID) |
| 972 | |
| 973 | |
| 974 | def logsumexp( |
no test coverage detected