TUTORIALAI & dataFETCHED
PyTorch torch.lt 函数
PyTorch torch.lt 函数 Pytorch torch 参考手册 torch.lt 是 PyTorch 中用于逐元素小于比较的函数。 函数定义 torch.lt(input, other, out) 使用示例 实例 [mycode4 type='python'] import torch a = torch.tensor([1, 2, 3, 4]) b = torch.tensor(..
Updated 7/16/2026
Tutorial detail pages default to noindex.
PyTorch torch.lt 函数
torch.lt 是 PyTorch 中用于逐元素小于比较的函数。
函数定义
torch.lt(input, other, out)
使用示例
实例
import torch
a = torch.tensor([1, 2, 3, 4])
b = torch.tensor([2, 2, 2, 2])
result = torch.lt(a, b)
print(result)
a = torch.tensor([1, 2, 3, 4])
b = torch.tensor([2, 2, 2, 2])
result = torch.lt(a, b)
print(result)
输出结果为:
tensor([ True, False, False, False])
Pytorch torch 参考手册