Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.frac function

PyTorch torch.frac function


PyTorch torch reference manual 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

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual