unique_values
- sparse.unique_values(x, /)[source]
Returns the unique elements of an input array x.
- Parameters:
x (COO) – Input COO array. It will be flattened if it is not already 1-D.
- Returns:
out – The unique elements of an input array.
- Return type:
ndarray
- Raises:
ValueError – If the input array is in a different format than COO.
Examples
>>> import sparse >>> x = sparse.COO.from_numpy([1, 0, 2, 1, 2, -3]) >>> sparse.unique_values(x) array([-3, 0, 1, 2])