PyTorch torch.frac Function
PyTorch torch Reference Manual
torch.fracIt is a function in PyTorch used to compute the element-wise fractional part.
Function Definition
torch.frac(input, out)
Usage Example
Example
import torch
# Calculate the fractional part
x = torch.tensor([1.5, 2.7, 3.1, 4.9])
result = torch.frac(x)
print(result)
# Calculate the fractional part
x = torch.tensor([1.5, 2.7, 3.1, 4.9])
result = torch.frac(x)
print(result)
Other Extensions