class nbla::Unique

template<typename T>
class Unique : public nbla::BaseFunction<bool, int, bool, bool, bool, bool>

Find the unique elements of input array.

Inputs:

  • x: A N-D array.

Outputs:

  • y: A N-D array.

  • indices: A 1-D array. It’s indices of `y` elements first occurance in `x`. If `flatten` is True, it contains indices to flattend input array `x`. If `flatten` is False and `axis` is specified, it contains indices to input array `x` on `axis`.

  • inverse_indices: A 1-D array. It’s indices of `x` elements corresponding to `y`. If `flatten` is True, it contains indices to output array `y`. If `flatten` is False and `axis` is specified, it contains indices to output array `y` on `axis`.

  • counts: A 1-D array. It’s the count of each element of ‘y’ in input array `x`.

Param flatten:

If True, unique values of the flatten input array are returned.

Param axis:

If flatten is True and axis is specified, unique slices along axis are returned.

Param sorted:

If True, unique values/slices sorted in ascending order are returned.

Param with_index:

If True, `indices` is returned.

Param with_inverse:

If True, `inverse_indices` is returned.

Param with_counts:

`counts` is returned.

Public Functions

inline virtual shared_ptr<Function> copy() const

Copy another instance of Function with the same context.

inline virtual int min_inputs()

Get minimum number of inputs.

This is meant to be used in setup function with in_types which is used to get maximum number of inputs.

inline virtual int min_outputs()

Get minimum number of outputs.

This is meant to be used in setup function with out_types which is used to get max number of outputs.

inline virtual vector<dtypes> in_types()

Get input dtypes.

Last in_type will be used repeatedly if size of in_types is smaller than size of inputs

inline virtual vector<dtypes> out_types()

Get output dtypes.

Last out_type will be used repeatedly if size of out_types is smaller than size of outputs

inline virtual vector<string> allowed_array_classes()

Get array classes that are allowed to be specified by Context.

inline virtual string name()

Get function name in string.