I have a 1D tensor a
of float64 numbers and I want to extract unique values. After running torch.unique(a)
or np.unique(a)
, I get an array which has a duplicate entries on the last two positions:
[-14.5 -13.5 -12.5 ... 23.5 24.5 24.5]
When I subtract the last two elements, I get
-3.552713678800501e-15
I suppose this happens because of floating point precision. Is there some way to efficiently find unique numbers (for example within some reasonable epsilon neighborhood)?
Thanks!