code: def unique_inverse(x):
      """
      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 : Tuple[ndarray, ndarray]
          a namedtuple (values, inverse_indices):
          values : ndarray
              The sorted unique values.
          inverse_indices : ndarray
              The indices to reconstruct the original array from the
              unique array.
      """
      UniqueInverse = namedtuple(
          "UniqueInverse", ["values", "inverse_indices"]
      )
      return UniqueInverse(*_mx_nd_np.unique(x, False, True, False))
  
imports: from collections import namedtuple
  from ..ndarray import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: unique_inverse(x) and returns: UniqueInverse