PyTorch torch.trunc 関数
torch.truncPyTorch において、要素ごとに切り捨て(整数部分を取る)を行う関数です。
関数定義
torch.trunc(input, out=None)
使用例
例
import torch
# 要素ごとに切り捨て
x = torch.tensor([1.5, 2.7, -3.3])
result = torch.trunc(x)
print(result)
# 要素ごとに切り捨て
x = torch.tensor([1.5, 2.7, -3.3])
result = torch.trunc(x)
print(result)
その他の拡張
Pytorch torch リファレンスマニュアル