code: def _execute_map(cls, ctx, op):
      chunk = op.outputs[0]
      # todo this function is an experimental one making shuffle runnable.
      # try elevate performance when needed.
      old_shape = op.oldshape
      new_shape = op.newshape
      new_chunk_size = op.new_chunk_size
      axis_offset = op.axis_offsets
  
      logger.debug(
          "Reshape mapper: Start mapping step for %s", chunk.key
      )
  
      data = ctx[op.inputs[0].key]
      indices = list(np.nonzero(data))
      nz_data = data[tuple(indices)]
  
      for idx in range(len(old_shape)):
          indices[idx] = np.add(
              indices[idx], axis_offset[idx], out=indices[idx]
          )
      rest_indices = indices[0]
      indices[0] = None
      for idx in range(1, len(old_shape)):
          rest_indices = np.multiply(
              rest_indices, old_shape[idx], out=rest_indices
          )
          rest_indices = np.add(
              rest_indices, indices[idx], out=rest_indices
          )
          indices[idx] = None
      del indices
  
      new_indices = []
      for dim_size in reversed(new_shape[1:]):
          new_index = rest_indices % dim_size
          new_indices.append(new_index)
          rest_indices = np.floor_divide(
              rest_indices, dim_size, out=rest_indices
          )
      new_indices.append(rest_indices)
      new_indices.reverse()
      del rest_indices
  
      logger.debug(
          "Reshape mapper: remapping to new locations for %s", chunk.key
      )
  
      dim_chunk_counts = [
          int(np.ceil(dim_size * 1.0 / chunk_size))
          for dim_size, chunk_size in zip(new_shape, new_chunk_size)
      ]
      target = new_indices[0] // new_chunk_size[0]
      for new_index, chunk_size, dim_chunk_count in zip(
          new_indices[1:], new_chunk_size[1:], dim_chunk_counts[1:]
      ):
          target = np.multiply(target, dim_chunk_count, out=target)
          target = np.add(target, new_index // chunk_size, out=target)
  
      for idx, chunk_size in enumerate(new_chunk_size):
          new_indices[idx] = np.mod(
              new_indices[idx], chunk_size, out=new_indices[idx]
          )
  
      logger.debug("Reshape mapper: sorting for %s", chunk.key)
  
      sort_idx = np.argsort(target)
      target = target[sort_idx]
      nz_data = nz_data[sort_idx]
      for idx in range(len(new_indices)):
          new_indices[idx] = new_indices[idx][sort_idx]
      del sort_idx
  
      logger.debug("Reshape mapper: splitting for %s", chunk.key)
  
      mapper_outputs = {}
      for t in np.unique(target):
          data_slice = slice(
              np.searchsorted(target, t),
              np.searchsorted(target, t, "right"),
          )
          group_indices = tuple(
              new_indices[idx][data_slice]
              for idx in range(len(new_shape))
          )
          group_data = nz_data[data_slice]
  
          target_chunk_idx = [None] * len(dim_chunk_counts)
          for idx, dim_chunk_count in enumerate(
              reversed(dim_chunk_counts)
          ):
              t, target_chunk_idx[idx] = divmod(t, dim_chunk_count)
          target_chunk_idx.reverse()
  
          mapper_outputs[
              chunk.key, tuple(target_chunk_idx)
          ] = group_indices + (group_data,)
  
      # ensure all mapper data are inserted context and fill missing partition with None
      for target_chunk_idx in itertools.product(
          *(range(dim_chunk_cnt) for dim_chunk_cnt in dim_chunk_counts)
      ):
          data_key = chunk.key, tuple(target_chunk_idx)
          ctx[data_key] = mapper_outputs.get(data_key)
  
imports: import itertools
  import logging
  import numpy
  from ...None import opcodes
  from ...core import recursive_tile
  from ...core.operand import OperandStage
  from ...serialization.serializables import FieldTypes, KeyField, TupleField, StringField
  from ...utils import has_unknown_shape
  from ..array_utils import as_same_device, device
  from ..datasource import tensor
  from ..operands import TensorOperandMixin, TensorMapReduceOperand, TensorShuffleProxy
  from ..utils import get_order, decide_chunk_sizes
label_desc: Use image node_id 18 for calling the TensorReshape obj's underlying member method code with example usage: obj._execute_map(cls, ctx, op) without return types