The doc of unique() says that return_inverse=True returns the indices for where elements in the original input ended up in the returned unique list as shown below:
sorted (bool) – Whether to sort the unique elements in ascending order before returning as output.
return_inverse (bool) – Whether to also return the indices for where elements in the original input ended up in the returned unique list.
return_counts (bool) – Whether to also return the counts for each unique element.
dim (int, optional) – the dimension to operate upon. If None, the unique of the flattened input is returned. Otherwise, each of the tensors indexed by the given dimension is treated as one of the elements to apply the unique operation upon. See examples for more details. Default: None
But the indices are not returned while return_counts=True properly returns the couns for each unique element as shown below:
📚 The doc issue
The doc of
unique()
says thatreturn_inverse=True
returns the indices for where elements in the original input ended up in the returned unique list as shown below:But the indices are not returned while
return_counts=True
properly returns the couns for each unique element as shown below:Suggest a potential alternative/fix