PyTorch torch.floor_divide 関数
torch.floor_dividePyTorch で要素ごとのフロア除算を行うための関数です。
関数定義
torch.floor_divide(input, other, *, out=None)
使用例
例
import torch
# フロア除算の例
x = torch.tensor([10.0, 20.0, 30.0, 40.0])
y = torch.tensor([3.0, 3.0, 3.0, 3.0])
result = torch.floor_divide(x, y)
print(result) # tensor([3., 6., 10., 13.])
# フロア除算の例
x = torch.tensor([10.0, 20.0, 30.0, 40.0])
y = torch.tensor([3.0, 3.0, 3.0, 3.0])
result = torch.floor_divide(x, y)
print(result) # tensor([3., 6., 10., 13.])
その他の拡張
Pytorch torch リファレンスマニュアル