PyTorch torch.trunc function
PyTorch torch reference manual
torch.trunc is a function in PyTorch used to truncate element-wise (take the integer part).
Function definition
torch.trunc(input, out=None)
Usage examples
Example
import
torch
Element-wise truncation
x
=
torch.
tensor
(
[
1.5
,
2.7
,
3.3
]
)
result
=
torch.
trunc
(
x
)
(
result
)