I'm tying to find distinct values in a PyTorch tensor. Is there an efficient analogue of Tensorflow's unique op?
I'm tying to find distinct values in a PyTorch tensor. Is there an efficient analogue of Tensorflow's unique op?
torch.eq()torch.unique:import torch as pt
a = pt.tensor([1,2,3,2,3,4,3,4,5,6])
b = pt.tensor([7,2,3,2,7,4,9,4,9,8])
equal_data = pt.eq(a, b)
pt.unique(pt.cat([a[equal_data],b[equal_data]]))