code: def _unique_1d(
      ar,
      return_index=False,
      return_inverse=False,
      return_counts=False,
      equal_nan=True,
  ):
      ar = cupy.asarray(ar).flatten()
  
      if return_index or return_inverse:
          perm = ar.argsort()
          aux = ar[perm]
      else:
          ar.sort()
          aux = ar
      mask = cupy.empty(aux.shape, dtype=cupy.bool_)
      mask[:1] = True
      mask[1:] = aux[1:] != aux[:-1]
      if equal_nan:
          _unique_update_mask_equal_nan(mask[1:], aux[:-1])
  
      ret = aux[mask]
      if not return_index and not return_inverse and not return_counts:
          return ret
  
      ret = (ret,)
      if return_index:
          ret += (perm[mask],)
      if return_inverse:
          imask = cupy.cumsum(mask) - 1
          inv_idx = cupy.empty(mask.shape, dtype=cupy.intp)
          inv_idx[perm] = imask
          ret += (inv_idx,)
      if return_counts:
          nonzero = cupy.nonzero(mask)[0]  # may synchronize
          idx = cupy.empty((nonzero.size + 1,), nonzero.dtype)
          idx[:-1] = nonzero
          idx[-1] = mask.size
          ret += (idx[1:] - idx[:-1],)
      return ret
  
file_path: cupy/cupy/_manipulation/add_remove.py
imports: import numpy
  import cupy
  import math
  from cupy import _core
label_desc: Use image node_id 7 for calling a global function with example usage: _unique_1d(ar, return_index, return_inverse, return_counts, equal_nan) and returns: ret, ret