sigmoid

Documentation

treetensor.torch.sigmoid(input, *args, **kwargs)[source]

Returns a tree of new tensors with the sigmoid of the elements of input.

Examples:

>>> import torch
>>> import treetensor.torch as ttorch
>>> ttorch.sigmoid(ttorch.tensor([1.0, 2.0, -1.5]))
tensor([0.7311, 0.8808, 0.1824])

>>> ttorch.sigmoid(ttorch.tensor({
...     'a': [1.0, 2.0, -1.5],
...     'b': {'x': [[0.5, 1.2], [-2.5, 0.25]]},
... }))
<Tensor 0x7f973a312820>
├── a --> tensor([0.7311, 0.8808, 0.1824])
└── b --> <Tensor 0x7f973a3128b0>
    └── x --> tensor([[0.6225, 0.7685],
                      [0.0759, 0.5622]])

Torch Version Related

This documentation is based on torch.sigmoid in torch v2.4.1+cu121. Its arguments’ arrangements depend on the version of pytorch you installed.

If some arguments listed here are not working properly, please check your pytorch’s version with the following command and find its documentation.

1
python -c 'import torch;print(torch.__version__)'

The arguments and keyword arguments supported in torch v2.4.1+cu121 is listed below.

Description From Torch v2.4.1+cu121

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

Alias for torch.special.expit().