PyTorch torch.frac 関数
torch.fracは PyTorch で要素ごとの小数部分を計算するための関数です。
関数定義
torch.frac(input, out)
使用例
例
import torch
# 小数部分を計算
x = torch.tensor([1.5, 2.7, 3.1, 4.9])
result = torch.frac(x)
print(result)
# 小数部分を計算
x = torch.tensor([1.5, 2.7, 3.1, 4.9])
result = torch.frac(x)
print(result)
その他の拡張
Pytorch torch リファレンスマニュアル