参考链接: gt(other) → Tensor
参考链接: torch.gt(input, other, out=None) → Tensor
代码实验展示:
Microsoft Windows [版本 10.0.18363.1256]
(c) 2019 Microsoft Corporation。保留所有权利。
C:\Users\chenxuqi>conda activate ssd4pytorch1_2_0
(ssd4pytorch1_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]))
tensor([[False, True],
[False, False]])
>>>
>>>
>>>
>>> torch.manual_seed(seed=20200910)
<torch._C.Generator object at 0x000001B69E54D330>
>>>
>>>
>>> input = torch.randn(3, 4)
>>> other = torch.randn(3, 4)
>>> input
tensor([[ 0.2824, -0.3715, 0.9088, -1.7601],
[-0.1806, 2.0937, 1.0406, -1.7651],
[ 1.1216, 0.8440, 0.1783, 0.6859]])
>>> other
tensor([[-1.5942, -0.2006, -0.4050, -0.5556],
[ 0.9571, 0.7435, -0.2974, -2.2825],
[-0.6627, -1.1902, -0.1748, 1.2125]])
>>>
>>> torch.gt(input, other)
tensor([[ True, False, True, False],
[False, True, True, True],
[ True, True, True, False]])
>>>
>>>
>>>
代码实验展示:
Microsoft Windows [版本 10.0.18363.1256]
(c) 2019 Microsoft Corporation。保留所有权利。
C:\Users\chenxuqi>conda activate ssd4pytorch1_2_0
(ssd4pytorch1_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.manual_seed(seed=20200910)
<torch._C.Generator object at 0x0000023D32A3D330>
>>>
>>> input = torch.randn(3, 4)
>>> other = torch.randn(3, 4)
>>>
>>> input
tensor([[ 0.2824, -0.3715, 0.9088, -1.7601],
[-0.1806, 2.0937, 1.0406, -1.7651],
[ 1.1216, 0.8440, 0.1783, 0.6859]])
>>> input.gt(0)
tensor([[ True, False, True, False],
[False, True, True, False],
[ True, True, True, True]])
>>>
>>>
>>> other
tensor([[-1.5942, -0.2006, -0.4050, -0.5556],
[ 0.9571, 0.7435, -0.2974, -2.2825],
[-0.6627, -1.1902, -0.1748, 1.2125]])
>>> other.gt(0)
tensor([[False, False, False, False],
[ True, True, False, False],
[False, False, False, True]])
>>>
>>>
>>>