code: def argsort(
      data, axis=-1, is_ascend=1, dtype="float32", ret_type="indices"
  ):
      """Performs sorting along the given axis and returns an array of indices
      having same shape as an input array that index data in sorted order.
  
      Parameters
      ----------
      data: tvm.te.Tensor
          The input array.
  
      axis : int, optional
          Axis long which to sort the input tensor.
  
      is_ascend : boolean, optional
          Whether to sort in ascending or descending order.
  
      dtype : string, optional
          DType of the output indices.
  
      ret_type : string, optional
          The return type [both, indices].
          "both": return both sorted data and indices.
          "indices": return sorted indices only.
  
      Returns
      -------
      out : tvm.te.Tensor
          The output of this function.
      """
      ndim = len(data.shape)
      axis = ndim + axis if axis < 0 else axis
      if axis != ndim - 1:
          # Prepare for sorting along axis -1.
          axes = swap(list(range(ndim)), axis)
          data = transpose(data, axes)
  
      value_buf = tvm.tir.decl_buffer(
          data.shape, data.dtype, "value_buf", data_alignment=8
      )
      value_swap_buf = tvm.tir.decl_buffer(
          data.shape, data.dtype, "value_swap_buf", data_alignment=8
      )
      indices_buf = tvm.tir.decl_buffer(
          data.shape, dtype, "out_buf", data_alignment=8
      )
      indices_swap_buf = tvm.tir.decl_buffer(
          data.shape, dtype, "out_swap_buf", data_alignment=8
      )
  
      outs = te.extern(
          [data.shape, data.shape, data.shape, data.shape],
          [data],
          lambda ins, outs: sort_ir(
              ins[0],
              outs[0],
              outs[2],
              -1,
              is_ascend,
              indices_out=outs[1],
              indices_out_swap=outs[3],
          ),
          out_buffers=[
              value_buf,
              indices_buf,
              value_swap_buf,
              indices_swap_buf,
          ],
          name="argsort_gpu",
          tag="argsort_gpu",
      )
  
      if axis != ndim - 1:
          axes = swap(list(range(ndim)), axis)
          outs = [transpose(out, axes) for out in outs]
  
      if ret_type == "indices":
          return outs[1]
  
      return outs[0], outs[1]
  
imports: import tvm
  from tvm import te
  from .injective import schedule_injective_from_existing
  from ..transform import strided_slice, transpose
  from ..None import tag
  from ..utils import ceil_div, swap
  from ..math import cast, ceil_log2
label_desc: Use image node_id 10 for calling a global function with example usage: argsort(data, axis, is_ascend, dtype, ret_type) and returns: outs,  outs, outs