The array API specification stipulates that we should have four partial functions for uniqueness computation rather than just one:
unique_values: torch.unique
unique_counts: roughly partial(torch.unique, return_counts=True)1
unique_inverse: roughly partial(torch.unique, return_inverse=True)1
unique_all: roughly partial(torch.unique, return_inverse=True, return_counts=True)1, with the caveat that actually 4 tensors should be returned, with the second element being the indices that denote the first occurences of the values in the input.
cc @mruberry @rgommers @pmeier @asmeurer @leofang @AnirudhDagar @asi1024 @emcastillo @kmaehashi
The array API specification stipulates that we should have four partial functions for uniqueness computation rather than just one:
unique_values:torch.uniqueunique_counts: roughlypartial(torch.unique, return_counts=True)1unique_inverse: roughlypartial(torch.unique, return_inverse=True)1unique_all: roughlypartial(torch.unique, return_inverse=True, return_counts=True)1, with the caveat that actually 4 tensors should be returned, with the second element being the indices that denote the first occurences of the values in the input.cc @mruberry @rgommers @pmeier @asmeurer @leofang @AnirudhDagar @asi1024 @emcastillo @kmaehashi
Footnotes
We currently return plain tuples, but for compliance with the array API, we need to return named tuples. ↩ ↩2 ↩3