floor_

Documentation

treetensor.torch.floor_(input)[source]

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

Examples:

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

>>> 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.floor_(t)
>>> t
<Tensor 0x7fbf53396d90>
├── a --> tensor([[ 1., -2.],
│                 [-3.,  2.]])
└── b --> <Tensor 0x7fbf533a0250>
    └── x --> tensor([[ 1., -4.,  1.],
                      [-5., -2.,  2.]])

Torch Version Related

This documentation is based on torch.floor_ in torch v1.9.0+cu102. 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__)'