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 参考手册