code: def unravel_index(idx, shape):
      """Convert the flattened ind to the coordinate array
  
      Parameters
      ----------
      idx : int or tvm.tir.IntImm
          The 1D index
  
      shape : tuple of int
          Shape of the tensor
  
      Returns
      -------
      indices : tuple of int or tvm.tir.IntImm
          Corresponding coordinate of the 1D index
      """
      idxd = tvm.tir.indexdiv
      idxm = tvm.tir.indexmod
      indices = []
      for i, dim in enumerate(reversed(shape)):
          if dim == 0:
              indices.append(0)
          elif i == len(shape) - 1:
              # Assuming the index is in-bounds, the last coordinate is
              # already less than dim, and doesn't need the be remainder
              # mod dim.
              indices.append(idx)
          else:
              indices.append(idxm(idx, dim))
              idx = idxd(idx, dim)
      indices = indices[::-1]
      return indices
  
imports: from __future__ import absolute_import
  from numbers import Integral
  import numpy
  import tvm
  from tvm import te
  from tvm.tir import Any, SizeVar, bijective_layout, layout
  from .None import cpp, tag
label_desc: Use image node_id 15 for calling a global function with example usage: unravel_index(idx, shape) and returns: indices