code: def multibox_transform_loc(
      cls_prob,
      loc_pred,
      anchor,
      clip=True,
      threshold=0.01,
      variances=(0.1, 0.1, 0.2, 0.2),
      keep_background=False,
  ):
      """Location transformation for multibox detection
  
      Parameters
      ----------
      cls_prob : tvm.te.Tensor
          Class probabilities.
  
      loc_pred : tvm.te.Tensor
          Location regression predictions.
  
      anchor : tvm.te.Tensor
          Prior anchor boxes.
  
      clip : boolean
          Whether to clip out-of-boundary boxes.
  
      threshold : float
          Threshold to be a positive prediction.
  
      variances : tuple of float
          Variances to be decoded from box regression output.
  
      keep_background : boolean
          Whether to keep boxes detected as background or not.
  
      Returns
      -------
      ret : tuple of tvm.te.Tensor composed of
  
      out : tvm.te.Tensor
          3-D tensor with shape (batch_size, num_anchors, 6)
  
      valid_count : tvm.te.Tensor
          1-D tensor with shape (batch_size,), number of valid anchor boxes.
      """
      batch_size = cls_prob.shape[0]
      num_anchors = cls_prob.shape[2]
      oshape = (batch_size, num_anchors, 6)
      # Define data alignment for intermediate buffer
      valid_count_dtype = "int32"
      out_loc_dtype = loc_pred.dtype
  
      valid_count_buf = tvm.tir.decl_buffer(
          (batch_size,),
          valid_count_dtype,
          "valid_count_buf",
          data_alignment=4,
      )
      loc_pred_buf = tvm.tir.decl_buffer(
          loc_pred.shape,
          loc_pred.dtype,
          "loc_pred_buf",
          data_alignment=8,
      )
      anchor_buf = tvm.tir.decl_buffer(
          anchor.shape, anchor.dtype, "anchor_buf", data_alignment=8
      )
  
      temp_valid_count_buf = tvm.tir.decl_buffer(
          (
              batch_size,
              num_anchors,
          ),
          valid_count_dtype,
          "temp_valid_count",
          data_alignment=8,
      )
      temp_cls_id_buf = tvm.tir.decl_buffer(
          (
              batch_size,
              num_anchors,
          ),
          valid_count_dtype,
          "temp_cls_id",
          data_alignment=8,
      )
      temp_score_buf = tvm.tir.decl_buffer(
          (
              batch_size,
              num_anchors,
          ),
          cls_prob.dtype,
          "temp_score",
          data_alignment=8,
      )
  
      (
          valid_count,
          temp_valid_count,
          temp_cls_id,
          temp_score,
      ) = te.extern(
          [
              (batch_size,),
              (
                  batch_size,
                  num_anchors,
              ),
              (
                  batch_size,
                  num_anchors,
              ),
              (
                  batch_size,
                  num_anchors,
              ),
          ],
          [cls_prob],
          lambda ins, outs: transform_loc_pre(
              ins[0],
              outs[0],
              outs[1],
              outs[2],
              outs[3],
              threshold,
              int(keep_background),
          ),
          dtype=[
              valid_count_dtype,
              valid_count_dtype,
              valid_count_dtype,
              cls_prob.dtype,
          ],
          out_buffers=[
              valid_count_buf,
              temp_valid_count_buf,
              temp_cls_id_buf,
              temp_score_buf,
          ],
          tag="multibox_transform_loc_phase_one",
      )
  
      out_loc = te.extern(
          [oshape],
          [loc_pred, anchor, temp_valid_count, temp_cls_id, temp_score],
          lambda ins, outs: transform_loc_ir(
              ins[0],
              ins[1],
              ins[2],
              ins[3],
              ins[4],
              outs[0],
              clip,
              variances,
              batch_size,
              num_anchors,
              int(keep_background),
          ),
          in_buffers=[
              loc_pred_buf,
              anchor_buf,
              temp_valid_count_buf,
              temp_cls_id_buf,
              temp_score_buf,
          ],
          dtype=[out_loc_dtype],
          tag="multibox_transform_loc",
      )
  
      return [out_loc, valid_count]
  
file_path: tvm/python/tvm/topi/cuda/ssd/multibox.py
imports: import math
  import tvm
  from tvm import te
  from tvm.tir import if_then_else, exp
  from tvm import topi
  from ..nms import non_max_suppression
label_desc: Use image node_id 5 for calling a global function with example usage: multibox_transform_loc(cls_prob, loc_pred, anchor, clip, threshold, variances, keep_background) and returns: list