torch.le¶ torch.le(input, other, *, out=None) → Tensor¶ 逐元素计算 input≤other\text{input} \leq \text{other}input≤other 。 第二个参数可以是数字或张量,其形状可与第一个参数 广播。 参数 input (Tensor) – 要比较的张量 other (Tensor 或 Scalar) – 要比较的张量或值 关键字参数 out (Tensor, 可选) – 输出张量。 返回 一个布尔张量,如果 input 小于或等于 other,则为 True,否则为 False 示例 >>> torch.le(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) tensor([[True, False], [True, True]])