TUTORIALAI 与数据科学FETCHED
PyTorch torch.floor 函数
PyTorch torch.floor 函数 Pytorch torch 参考手册 torch.floor 是 PyTorch 中用于逐元素向下取整的函数。 函数定义 torch.floor(input, out=None) 使用示例 实例 [mycode4 type='python'] import torch x = torch.tensor([1.1, 2.5, 3.7, -1.2]) ..
更新于 2026/7/16
教程详情页默认 noindex。
PyTorch torch.floor 函数
torch.floor 是 PyTorch 中用于逐元素向下取整的函数。
函数定义
torch.floor(input, out=None)
使用示例
实例
import torch
x = torch.tensor([1.1, 2.5, 3.7, -1.2])
print(torch.floor(x))
x = torch.tensor([1.1, 2.5, 3.7, -1.2])
print(torch.floor(x))
输出结果为:
tensor([1., 2., 3., -2.])
Pytorch torch 参考手册