PytorchBackend.unique#

PytorchBackend.unique(ar, return_index=False, return_inverse=False, return_counts=False, axis=None, sorted=True)[source]#

Find the unique elements of an array.

Parameters:
arrBackendArray

Input data.

return_indexbool, optional

Return indices that resulted in unique array, False by default.

return_inversebool, optional

Return indices to reconstruct the input, False by default.

return_countsbool, optional

Return number of occurences of each unique element, False by default.

axisint or tuple of ints, optional

Axis or axes to perform the operation on. Default is all.

Returns:
BackendArray or tuple of BackendArray

If return_index, return_inverse, and return_counts keyword arguments are all False (the default), this will be an BackendArray object of the sorted unique values. Otherwise, it’s a tuple with one or more arrays as specified by those keyword arguments.