code: def flatten(data):
      """Flattens the input array into a 2-D array by collapsing the higher dimensions.
  
      Parameters
      ----------
      data : tvm.te.Tensor
          Input array.
  
      Returns
      -------
      output : tvm.te.Tensor
          2-D array with collapsed higher dimensions.
      """
      ishape = data.shape
      dim = 1
      for i in range(1, len(ishape)):
          dim = dim * ishape[i]
      oshape = [ishape[0], dim]
      idxdiv = tvm.tir.indexdiv
      idxmod = tvm.tir.indexmod
  
      def unwrap(idx, shape):
          index = []
          for s in reversed(shape):
              index.append(idxmod(idx, s))
              idx = idxdiv(idx, s)
          return list(reversed(index))
  
      return te.compute(
          oshape, lambda i, j: data(i, *unwrap(j, ishape[1:]))
      )
  
imports: from __future__ import absolute_import
  import tvm
  from tvm import te
  from ..None import tag
label_desc: Use image node_id 1 for calling a global function with example usage: flatten(data) and returns: te, list