fn
unique
→Tensorunique(input: Tensor)Return the sorted unique elements of input.
Duplicate values are removed and the output is sorted in ascending
order. By default the input is flattened — pass a dim argument
via the underlying implementation to operate axis-wise.
Parameters
inputTensorSource tensor.
Returns
Tensor1-D tensor of unique values in ascending order.
Notes
Because the output size is data-dependent this op forces a host round-trip on accelerator backends.
Examples
>>> import lucid
>>> x = lucid.tensor([3, 1, 2, 3, 1, 4])
>>> lucid.unique(x)
Tensor([1, 2, 3, 4])