https://pytorch.org/docs/stable/torch.html#comparison-ops

import torch
a = torch.randint(0, 10, [5])
b = torch.randint(0, 10, [5])
print(a)
print(b)
tensor([9, 0, 9, 2, 4])
tensor([7, 8, 5, 3, 6])
a.lt(b)         # <
tensor([False,  True, False,  True,  True])
torch.le(a, b) # <=
tensor([False,  True, False,  True,  True])
a.gt(b)        # >
tensor([ True, False,  True, False, False])
a.ge(b)        # >=
tensor([ True, False,  True, False, False])
a.ne(b)       # !=
tensor([True, True, True, True, True])


Share on: TwitterFacebookEmail

Comments


Related Posts


Published

Category

NLP

Tags

Contact