mxnet.numpy.set_functions

Standard Array API for creating and operating on sets.

Functions

unique_all(x)

Returns the unique elements of an input array x

unique_inverse(x)

Returns the unique elements of an input array x and the indices from the set of unique elements that reconstruct x.

unique_values(x)

Returns the unique elements of an input array x.

mxnet.numpy.set_functions.unique_all(x)[source]

Returns the unique elements of an input array x

Notes

unique_all is a standard API in https://data-apis.org/array-api/latest/API_specification/set_functions.html#unique-all-x instead of an official NumPy operator.

Parameters:

x (ndarray) – Input array. This will be flattened if it is not already 1-D.

Returns:

out – a namedtuple (values, indices, inverse_indices, counts): values : ndarray

The sorted unique values.

indicesndarray, optional

The indices of the first occurrences of the unique values in the original array.

inverse_indicesndarray

The indices to reconstruct the original array from the unique array.

countsndarray

The number of times each of the unique values comes up in the original array.

Return type:

Tuple[ndarray, ndarray, ndarray, ndarray]

mxnet.numpy.set_functions.unique_inverse(x)[source]

Returns the unique elements of an input array x and the indices from the set of unique elements that reconstruct x.

Notes

unique_inverse is a standard API in https://data-apis.org/array-api/latest/API_specification/set_functions.html#unique-inverse-x instead of an official NumPy operator.

Parameters:

x (ndarray) – Input array. This will be flattened if it is not already 1-D.

Returns:

out – a namedtuple (values, inverse_indices): values : ndarray

The sorted unique values.

inverse_indicesndarray

The indices to reconstruct the original array from the unique array.

Return type:

Tuple[ndarray, ndarray]

mxnet.numpy.set_functions.unique_values(x)[source]

Returns the unique elements of an input array x.

Notes

unique_values is a standard API in https://data-apis.org/array-api/latest/API_specification/set_functions.html#unique-values-x instead of an official NumPy operator.

Parameters:

x (ndarray) – Input array. This will be flattened if it is not already 1-D.

Returns:

out – The sorted unique values.

Return type:

ndarray