ceil_

Documentation

treetensor.torch.ceil_(input)[source]

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

Examples:

>>> import torch
>>> import treetensor.torch as ttorch
>>> t = ttorch.tensor([[1.2, -1.8], [-2.3, 2.8]])
>>> ttorch.ceil_(t)
>>> t
tensor([[ 2., -1.],
        [-2.,  3.]])

>>> t = ttorch.tensor({
...     'a': [[1.2, -1.8], [-2.3, 2.8]],
...     'b': {'x': [[1.0, -3.9, 1.3], [-4.8, -2.0, 2.8]]},
... })
>>> ttorch.ceil_(t)
>>> t
<Tensor 0x7f1c81d78040>
├── a --> tensor([[ 2., -1.],
│                 [-2.,  3.]])
└── b --> <Tensor 0x7f1c81d780d0>
    └── x --> tensor([[ 1., -3.,  2.],
                      [-4., -2.,  3.]])

Torch Version Related

This documentation is based on torch.ceil_ in torch v2.0.1+cu117. 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__)'