code: def _execute_map(cls, ctx, op: "TensorUnique"):
      (ar,), device_id, xp = as_same_device(
          [ctx[c.key] for c in op.inputs],
          device=op.device,
          ret_extra=True,
      )
      n_reducers = op.aggregate_size
  
      with device(device_id):
          results = xp.unique(
              ar,
              return_index=op.return_index,
              return_inverse=op.return_inverse,
              return_counts=op.return_counts,
              axis=op.axis,
          )
          results = (
              (results,) if not isinstance(results, tuple) else results
          )
          results_iter = iter(results)
          unique_ar = next(results_iter)
          indices_ar = (
              next(results_iter) + op.start_pos
              if op.return_index
              else None
          )
          inverse_ar = next(results_iter) if op.return_inverse else None
          counts_ar = next(results_iter) if op.return_counts else None
  
          if xp is sparse:
              dense_xp = get_sparse_array_module(unique_ar)
          else:
              dense_xp = xp
          unique_index = (
              dense_xp.arange(unique_ar.shape[op.axis])
              if inverse_ar is not None
              else None
          )
          if unique_ar.size > 0:
              unique_reducers = dense_xp.asarray(
                  hash_on_axis(unique_ar, op.axis, n_reducers)
              )
          else:
              unique_reducers = dense_xp.empty_like(unique_ar)
          ind_ar = dense_xp.arange(ar.shape[op.axis])
  
          for reducer in range(n_reducers):
              res = []
              cond = unique_reducers == reducer
              # unique
              slc = (slice(None),) * op.axis + (cond,)
              res.append(unique_ar[slc])
              # indices
              if indices_ar is not None:
                  res.append(indices_ar[cond])
              # inverse
              if inverse_ar is not None:
                  index_selected = unique_index[cond]
                  inv_cond = xp.isin(inverse_ar, index_selected)
                  inv_selected = xp.searchsorted(
                      index_selected, inverse_ar[inv_cond]
                  )
                  ind_selected = ind_ar[inv_cond]
                  res.append(xp.stack([ind_selected, inv_selected]))
              # counts
              if counts_ar is not None:
                  res.append(counts_ar[cond])
              ctx[op.outputs[0].key, (reducer,)] = (
                  ctx.get_current_chunk().index,
                  tuple(res),
              )
  
imports: import itertools
  import numpy
  from ...None import opcodes
  from ...config import options
  from ...core import recursive_tile
  from ...core.operand import OperandStage
  from ...lib import sparse
  from ...lib.sparse.core import get_array_module
  from ...serialization.serializables import BoolField, Int32Field, Int64Field
  from ...utils import has_unknown_shape
  from ..operands import TensorMapReduceOperand, TensorOperandMixin, TensorShuffleProxy
  from ..array_utils import as_same_device, device
  from ..core import TensorOrder
  from ..utils import validate_axis, hash_on_axis
label_desc: Use image node_id 14 for calling the TensorUnique obj's underlying member method code with example usage: obj._execute_map(cls, ctx, op) without return types