PyTorch torch.frac function
PyTorch torch reference manual
torch.frac A function in PyTorch for computing the element-wise fractional part.
Function definition
torch.frac(input, out)
Usage examples
Example
import
torch
Compute the fractional part
x
=
torch.
tensor
(
[
1.5
,
2.7
,
3.1
,
4.9
]
)
result
=
torch.
frac
(
x
)
(
result
)