code: def setitem_to_records(tensor, tensor_index, value, timestamp):
      """
      Compute the records of `__setitem__` on tensor for every chunk.
  
      Returns
      -------
          dict, a dict of chunk index to records in that chunk.
      """
      (
          output_shape,
          output_chunks,
          nsplits_acc,
      ) = compute_output_of_indexing(tensor, tensor_index)
  
      is_scalar = (
          np.isscalar(value)
          or isinstance(value, tuple)
          and tensor.dtype.fields is not None
      )
      if not is_scalar:
          value = np.broadcast_to(value, output_shape).astype(
              tensor.dtype
          )
  
      records = dict()
      for output_chunk in output_chunks:
          records_in_chunk = setitem_on_chunk_to_records(
              nsplits_acc,
              output_chunk,
              value,
              timestamp,
              is_scalar=is_scalar,
          )
          records[output_chunk.op.inputs[0].index] = records_in_chunk
      return records
  
file_path: mars/mars/services/mutable/utils.py
imports: from datetime import datetime
  import itertools
  from numbers import Integral
  from typing import Optional
  import uuid
  import numpy
  from ...core import tile
label_desc: Use image node_id 4 for calling a global function with example usage: setitem_to_records(tensor, tensor_index, value, timestamp) and returns: records