PyTorch torch.frac Function


Pytorch torch 参考手册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)

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions