PyTorch torch.floor_divide 函数
torch.floor_divide 是 PyTorch 中用于逐元素整除的函数。
函数定义
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 参考手册