Shortcuts

torch.gt

torch.gt(input, other, *, out=None) 张量

计算 input>other\text{input} > \text{other} 逐元素。

第二个参数可以是一个数字或一个张量,其形状与第一个参数是可广播的

Parameters
Keyword Arguments

输出 (张量, 可选) – 输出张量。

Returns

一个布尔张量,其中在 input 大于 other 的地方为 True,其他地方为 False

示例:

>>> torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]))
tensor([[False, True], [False, False]])
优云智算