sigmoid_

Documentation

treetensor.torch.sigmoid_(input)[source]

In-place version of treetensor.torch.sigmoid().

Examples:

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

>>> t = ttorch.tensor({
...     'a': [1.0, 2.0, -1.5],
...     'b': {'x': [[0.5, 1.2], [-2.5, 0.25]]},
... })
>>> ttorch.sigmoid_(t)
>>> t
<Tensor 0x7f68fea8d040>
├── a --> tensor([0.7311, 0.8808, 0.1824])
└── b --> <Tensor 0x7f68fea8ee50>
    └── 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__)'