PyTorch torch.ge 函数

约 247 字 更新于 2026-11-18 5iyo.com

PyTorch torch.ge 函数


torch.ge 是 PyTorch 中用于逐元素大于等于比较的函数。

函数定义

torch.ge(input, other, out)

使用示例

实例

import torch

# 逐元素大于等于比较
x = torch.tensor([1, 2, 3, 4])
y = torch.tensor([2, 2, 2, 5])

result = torch.ge(x, y)
print(result)