TUTORIALAI & dataFETCHED
PyTorch torch.le 函数
PyTorch torch.le 函数 Pytorch torch 参考手册 torch.le 是 PyTorch 中用于逐元素小于等于比较的函数。 函数定义 torch.le(input, other, out) 使用示例 实例 [mycode4 type='python'] import torch # 逐元素小于等于比较 x = torch.tensor([1, 2, 3, 4]) y =..
Updated 7/16/2026
Tutorial detail pages default to noindex.
PyTorch torch.le 函数
torch.le 是 PyTorch 中用于逐元素小于等于比较的函数。
函数定义
torch.le(input, other, out)
使用示例
实例
import torch
# 逐元素小于等于比较
x = torch.tensor([1, 2, 3, 4])
y = torch.tensor([2, 2, 2, 5])
result = torch.le(x, y)
print(result)
# 逐元素小于等于比较
x = torch.tensor([1, 2, 3, 4])
y = torch.tensor([2, 2, 2, 5])
result = torch.le(x, y)
print(result)
Pytorch torch 参考手册