*Memos:
- My post explains gt() and lt().
 - My post explains eq() and ne().
 - My post explains isclose() and equal().
 
ge() can check if the zero or more elements of the 1st 0D or more D tensor are greater than or equal to the zero or more elements of the 2nd 0D or more D tensor element-wise, getting the 0D or more D tensor of zero or more elements as shown below:
*Memos:
- 
ge()can be used with torch or a tensor. - The 1st argument(
input) withtorchor using a tensor(Required-Type:tensorofint,floatorbool). - The 2nd argument with 
torchor the 1st argument with a tensor isother(Required-Type:tensororscalarofint,floatorbool). - There is 
outargument withtorch(Optional-Default:None-Type:tensor): *Memos:- 
out=must be used. - 
My post explains 
outargument. 
 - 
 - 
greater_equal() is the alias of 
ge(). 
import torch
tensor1 = torch.tensor([5, 0, 3])
tensor2 = torch.tensor([3, 5, 4])
torch.ge(input=tensor1, other=tensor2)
tensor1.ge(other=tensor2)
# tensor([True, False, False])
torch.ge(input=tensor2, other=tensor1)
# tensor([False, True, True])
tensor1 = torch.tensor([5, 0, 3])
tensor2 = torch.tensor([[3, 5, 4],
                        [6, 3, 5]])
torch.ge(input=tensor1, other=tensor2)
# tensor([[True, False, False],
#         [False, False, False]])
torch.ge(input=tensor2, other=tensor1)
# tensor([[False, True, True],
#         [True, True, True]])
torch.ge(input=tensor1, other=3)
# tensor([True, False, True])
torch.ge(input=tensor2, other=3)
# tensor([[True, True, True],
#         [True, True, True]])
tensor1 = torch.tensor([5., 0., 3.])
tensor2 = torch.tensor([[3., 5., 4.],
                        [6., 3., 5.]])
torch.ge(input=tensor1, other=tensor2)
# tensor([[True, False, False],
#         [False, False, False]])
torch.ge(input=tensor1, other=3.)
# tensor([True, False, True])
tensor1 = torch.tensor([True, False, True])
tensor2 = torch.tensor([[True, False, True],
                        [False, True, False]])
torch.ge(input=tensor1, other=tensor2)
# tensor([[True, True, True],
#         [True, False, True]])
torch.ge(input=tensor1, other=True)
# tensor([True, False, True])
le() can check if the zero or more elements of the 1st 0D or more D tensor are less than or equal to the zero or more elements of the 2nd 0D or more D tensor element-wise, getting the 0D or more D tensor of zero or more element as shown below:
*Memos:
- 
le()can be used withtorchor a tensor. - The 1st argument(
input) withtorchor using a tensor(Required-Type:tensorofint,floatorbool). - The 2nd argument with 
torchor the 1st argument with a tensor isother(Required-Type:tensororscalarofint,floatorbool). - There is 
outargument withtorch(Optional-Default:None-Type:tensor): *Memos:- 
out=must be used. - 
My post explains 
outargument. 
 - 
 - 
less_equal() is the alias of 
le(). 
import torch
tensor1 = torch.tensor([5, 0, 3])
tensor2 = torch.tensor([3, 5, 4])
torch.le(input=tensor1, other=tensor2)
tensor1.le(other=tensor2)
# tensor([False, True, True])
torch.le(input=tensor2, other=tensor1)
# tensor([True, False, False])
tensor1 = torch.tensor([5, 0, 3])
tensor2 = torch.tensor([[3, 5, 4],
                        [6, 3, 5]])
torch.le(input=tensor1, other=tensor2)
# tensor([[False, True, True],
#         [True, True, True]])
torch.le(input=tensor2, other=tensor1)
# tensor([[True, False, False],
#         [False, False, False]])
torch.le(input=tensor1, other=3)
# tensor([False, True, True])
torch.le(input=tensor2, other=3)
# tensor([[True, False, False],
#         [False, True, False]])
tensor1 = torch.tensor([5., 0., 3.])
tensor2 = torch.tensor([[3., 5., 4.],
                        [6., 3., 5.]])
torch.le(input=tensor1, other=tensor2)
# tensor([[False, True, True],
#         [True, True, True]])
torch.le(input=tensor1, other=3.)
# tensor([False, True, True])
tensor1 = torch.tensor([True, False, True])
tensor2 = torch.tensor([[True, False, True],
                        [False, True, False]])
torch.le(input=tensor1, other=tensor2)
# tensor([[True, True, True],
#         [False, True, False]])
torch.le(input=tensor1, other=True)
# tensor([True, True, True])
    
Top comments (0)