Skip to content
fn

unique_op

→TensorImplPtr
int unique_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Unique sorted elements of a tensor.

Flattens a, removes duplicates, and returns the result sorted in ascending order as a 1-D tensor.

Parameters

aTensorImplPtr
Input tensor. Supported dtypes: F32, F64, I32, I64.

Returns

TensorImplPtr

1-D tensor of the same dtype as a containing the unique elements in sorted order. Always resides on Device::CPU because the output length is data-dependent.

Notes

Non-differentiable.