In Python one can do the following to get the unique values in a vector/matrix/tensor:
import numpy as np
a = np.unique([1, 1, 2, 2, 3, 3])
# Now a = array([1, 2, 3])
There is a similar function in MATLAB as well:
A = [9 2 9 5];
C = unique(A)
%Now C = [9, 2, 9]
Is there an equivalent function in Torch/Lua as well?