code: def indexing_to_chunk_indices(output_chunk):
      """
      Compute input_indices and value_indices when read from or write to
      a tensor chunk.
  
      Parameters
      ----------
      output_chunk:
          A chunk in the output of the `__setitem__` op.
  
      Returns
      -------
          The indices in the input chunk, and value_indices in the value block
          that will be assigned.
      """
      input_indices = []  # index in the chunk of the mutable tensor
      value_indices = []  # index in the chunk of the assigned value
      for d, s in zip(
          output_chunk.op.indexes, output_chunk.op.inputs[0].shape
      ):
          # expand the index (slice)
          idx = np.r_[
              slice(*d.indices(s)) if isinstance(d, slice) else d
          ]
          input_indices.append(idx)
          if not isinstance(d, Integral):
              value_indices.append(np.arange(len(idx)))
      return input_indices, value_indices
  
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 1 for calling a global function with example usage: indexing_to_chunk_indices(output_chunk) and returns: input_indices,  value_indices