def detection_output(loc, scores, prior_box, prior_box_var, background_label=0, nms_threshold=0.3, nms_top_k=400, keep_top_k=200, score_threshold=0.01, nms_eta=1.0, return_index=False):
    "\n\t:alias_main: paddle.nn.functional.detection_output\n\t:alias: paddle.nn.functional.detection_output,paddle.nn.functional.vision.detection_output\n\t:old_api: paddle.fluid.layers.detection_output\n\n    Given the regression locations, classification confidences and prior boxes,\n    calculate the detection outputs by performing following steps:\n\n    1. Decode input bounding box predictions according to the prior boxes and\n       regression locations.\n    2. Get the final detection results by applying multi-class non maximum\n       suppression (NMS).\n\n    Please note, this operation doesn't clip the final output bounding boxes\n    to the image window.\n\n    Args:\n        loc(Variable): A 3-D Tensor with shape [N, M, 4] represents the\n            predicted locations of M bounding bboxes. Data type should be\n            float32 or float64. N is the batch size,\n            and each bounding box has four coordinate values and the layout\n            is [xmin, ymin, xmax, ymax].\n        scores(Variable): A 3-D Tensor with shape [N, M, C] represents the\n            predicted confidence predictions. Data type should be float32\n            or float64. N is the batch size, C is the\n            class number, M is number of bounding boxes.\n        prior_box(Variable): A 2-D Tensor with shape [M, 4] holds M boxes,\n            each box is represented as [xmin, ymin, xmax, ymax]. Data type\n            should be float32 or float64.\n        prior_box_var(Variable): A 2-D Tensor with shape [M, 4] holds M group\n            of variance. Data type should be float32 or float64.\n        background_label(int): The index of background label,\n            the background label will be ignored. If set to -1, then all\n            categories will be considered. Default: 0.\n        nms_threshold(float): The threshold to be used in NMS. Default: 0.3.\n        nms_top_k(int): Maximum number of detections to be kept according\n            to the confidences after filtering detections based on\n            score_threshold and before NMS. Default: 400.\n        keep_top_k(int): Number of total bboxes to be kept per image after\n            NMS step. -1 means keeping all bboxes after NMS step. Default: 200.\n        score_threshold(float): Threshold to filter out bounding boxes with\n            low confidence score. If not provided, consider all boxes.\n            Default: 0.01.\n        nms_eta(float): The parameter for adaptive NMS. It works only when the\n            value is less than 1.0. Default: 1.0.\n        return_index(bool): Whether return selected index. Default: False\n\n    Returns:\n\n        A tuple with two Variables: (Out, Index) if return_index is True,\n        otherwise, a tuple with one Variable(Out) is returned. \n\n        Out (Variable): The detection outputs is a LoDTensor with shape [No, 6].\n        Data type is the same as input (loc). Each row has six values:\n        [label, confidence, xmin, ymin, xmax, ymax]. `No` is\n        the total number of detections in this mini-batch. For each instance,\n        the offsets in first dimension are called LoD, the offset number is\n        N + 1, N is the batch size. The i-th image has `LoD[i + 1] - LoD[i]`\n        detected results, if it is 0, the i-th image has no detected results.\n\n        Index (Variable): Only return when return_index is True. A 2-D LoDTensor\n        with shape [No, 1] represents the selected index which type is Integer.\n        The index is the absolute value cross batches. No is the same number\n        as Out. If the index is used to gather other attribute such as age,\n        one needs to reshape the input(N, M, 1) to (N * M, 1) as first, where\n        N is the batch size and M is the number of boxes.\n\n\n    Examples:\n        .. code-block:: python\n\n            import paddle.fluid as fluid\n\n            pb = fluid.data(name='prior_box', shape=[10, 4], dtype='float32')\n            pbv = fluid.data(name='prior_box_var', shape=[10, 4], dtype='float32')\n            loc = fluid.data(name='target_box', shape=[2, 21, 4], dtype='float32')\n            scores = fluid.data(name='scores', shape=[2, 21, 10], dtype='float32')\n            nmsed_outs, index = fluid.layers.detection_output(scores=scores,\n                                       loc=loc,\n                                       prior_box=pb,\n                                       prior_box_var=pbv,\n                                       return_index=True)\n    "
    helper = LayerHelper('detection_output', **locals())
    decoded_box = box_coder(prior_box=prior_box, prior_box_var=prior_box_var, target_box=loc, code_type='decode_center_size')
    scores = nn.softmax(input=scores)
    scores = nn.transpose(scores, perm=[0, 2, 1])
    scores.stop_gradient = True
    nmsed_outs = helper.create_variable_for_type_inference(dtype=decoded_box.dtype)
    if return_index:
        index = helper.create_variable_for_type_inference(dtype='int')
        helper.append_op(type='multiclass_nms2', inputs={'Scores': scores, 'BBoxes': decoded_box}, outputs={'Out': nmsed_outs, 'Index': index}, attrs={'background_label': 0, 'nms_threshold': nms_threshold, 'nms_top_k': nms_top_k, 'keep_top_k': keep_top_k, 'score_threshold': score_threshold, 'nms_eta': 1.0})
        index.stop_gradient = True
    else:
        helper.append_op(type='multiclass_nms', inputs={'Scores': scores, 'BBoxes': decoded_box}, outputs={'Out': nmsed_outs}, attrs={'background_label': 0, 'nms_threshold': nms_threshold, 'nms_top_k': nms_top_k, 'keep_top_k': keep_top_k, 'score_threshold': score_threshold, 'nms_eta': 1.0})
    nmsed_outs.stop_gradient = True
    if return_index:
        return (nmsed_outs, index)
    return nmsed_outs
:alias_main: paddle.nn.functional.detection_output
    :alias: paddle.nn.functional.detection_output,paddle.nn.functional.vision.detection_output
    :old_api: paddle.fluid.layers.detection_output

Given the regression locations, classification confidences and prior boxes,
calculate the detection outputs by performing following steps:

1. Decode input bounding box predictions according to the prior boxes and
   regression locations.
2. Get the final detection results by applying multi-class non maximum
   suppression (NMS).

Please note, this operation doesn't clip the final output bounding boxes
to the image window.

Args:
    loc(Variable): A 3-D Tensor with shape [N, M, 4] represents the
        predicted locations of M bounding bboxes. Data type should be
        float32 or float64. N is the batch size,
        and each bounding box has four coordinate values and the layout
        is [xmin, ymin, xmax, ymax].
    scores(Variable): A 3-D Tensor with shape [N, M, C] represents the
        predicted confidence predictions. Data type should be float32
        or float64. N is the batch size, C is the
        class number, M is number of bounding boxes.
    prior_box(Variable): A 2-D Tensor with shape [M, 4] holds M boxes,
        each box is represented as [xmin, ymin, xmax, ymax]. Data type
        should be float32 or float64.
    prior_box_var(Variable): A 2-D Tensor with shape [M, 4] holds M group
        of variance. Data type should be float32 or float64.
    background_label(int): The index of background label,
        the background label will be ignored. If set to -1, then all
        categories will be considered. Default: 0.
    nms_threshold(float): The threshold to be used in NMS. Default: 0.3.
    nms_top_k(int): Maximum number of detections to be kept according
        to the confidences after filtering detections based on
        score_threshold and before NMS. Default: 400.
    keep_top_k(int): Number of total bboxes to be kept per image after
        NMS step. -1 means keeping all bboxes after NMS step. Default: 200.
    score_threshold(float): Threshold to filter out bounding boxes with
        low confidence score. If not provided, consider all boxes.
        Default: 0.01.
    nms_eta(float): The parameter for adaptive NMS. It works only when the
        value is less than 1.0. Default: 1.0.
    return_index(bool): Whether return selected index. Default: False

Returns:

    A tuple with two Variables: (Out, Index) if return_index is True,
    otherwise, a tuple with one Variable(Out) is returned. 

    Out (Variable): The detection outputs is a LoDTensor with shape [No, 6].
    Data type is the same as input (loc). Each row has six values:
    [label, confidence, xmin, ymin, xmax, ymax]. `No` is
    the total number of detections in this mini-batch. For each instance,
    the offsets in first dimension are called LoD, the offset number is
    N + 1, N is the batch size. The i-th image has `LoD[i + 1] - LoD[i]`
    detected results, if it is 0, the i-th image has no detected results.

    Index (Variable): Only return when return_index is True. A 2-D LoDTensor
    with shape [No, 1] represents the selected index which type is Integer.
    The index is the absolute value cross batches. No is the same number
    as Out. If the index is used to gather other attribute such as age,
    one needs to reshape the input(N, M, 1) to (N * M, 1) as first, where
    N is the batch size and M is the number of boxes.


Examples:
    .. code-block:: python

        import paddle.fluid as fluid

        pb = fluid.data(name='prior_box', shape=[10, 4], dtype='float32')
        pbv = fluid.data(name='prior_box_var', shape=[10, 4], dtype='float32')
        loc = fluid.data(name='target_box', shape=[2, 21, 4], dtype='float32')
        scores = fluid.data(name='scores', shape=[2, 21, 10], dtype='float32')
        nmsed_outs, index = fluid.layers.detection_output(scores=scores,
                                   loc=loc,
                                   prior_box=pb,
                                   prior_box_var=pbv,
                                   return_index=True)
def detection_output(loc, scores, prior_box, prior_box_var, background_label=0, nms_threshold=0.3, nms_top_k=400, keep_top_k=200, score_threshold=0.01, nms_eta=1.0, return_index=False):
    "\n\t:alias_main: paddle.nn.functional.detection_output\n\t:alias: paddle.nn.functional.detection_output,paddle.nn.functional.vision.detection_output\n\t:old_api: paddle.fluid.layers.detection_output\n\n    Given the regression locations, classification confidences and prior boxes,\n    calculate the detection outputs by performing following steps:\n\n    1. Decode input bounding box predictions according to the prior boxes and\n       regression locations.\n    2. Get the final detection results by applying multi-class non maximum\n       suppression (NMS).\n\n    Please note, this operation doesn't clip the final output bounding boxes\n    to the image window.\n\n    Args:\n        loc(Variable): A 3-D Tensor with shape [N, M, 4] represents the\n            predicted locations of M bounding bboxes. Data type should be\n            float32 or float64. N is the batch size,\n            and each bounding box has four coordinate values and the layout\n            is [xmin, ymin, xmax, ymax].\n        scores(Variable): A 3-D Tensor with shape [N, M, C] represents the\n            predicted confidence predictions. Data type should be float32\n            or float64. N is the batch size, C is the\n            class number, M is number of bounding boxes.\n        prior_box(Variable): A 2-D Tensor with shape [M, 4] holds M boxes,\n            each box is represented as [xmin, ymin, xmax, ymax]. Data type\n            should be float32 or float64.\n        prior_box_var(Variable): A 2-D Tensor with shape [M, 4] holds M group\n            of variance. Data type should be float32 or float64.\n        background_label(int): The index of background label,\n            the background label will be ignored. If set to -1, then all\n            categories will be considered. Default: 0.\n        nms_threshold(float): The threshold to be used in NMS. Default: 0.3.\n        nms_top_k(int): Maximum number of detections to be kept according\n            to the confidences after filtering detections based on\n            score_threshold and before NMS. Default: 400.\n        keep_top_k(int): Number of total bboxes to be kept per image after\n            NMS step. -1 means keeping all bboxes after NMS step. Default: 200.\n        score_threshold(float): Threshold to filter out bounding boxes with\n            low confidence score. If not provided, consider all boxes.\n            Default: 0.01.\n        nms_eta(float): The parameter for adaptive NMS. It works only when the\n            value is less than 1.0. Default: 1.0.\n        return_index(bool): Whether return selected index. Default: False\n\n    Returns:\n\n        A tuple with two Variables: (Out, Index) if return_index is True,\n        otherwise, a tuple with one Variable(Out) is returned. \n\n        Out (Variable): The detection outputs is a LoDTensor with shape [No, 6].\n        Data type is the same as input (loc). Each row has six values:\n        [label, confidence, xmin, ymin, xmax, ymax]. `No` is\n        the total number of detections in this mini-batch. For each instance,\n        the offsets in first dimension are called LoD, the offset number is\n        N + 1, N is the batch size. The i-th image has `LoD[i + 1] - LoD[i]`\n        detected results, if it is 0, the i-th image has no detected results.\n\n        Index (Variable): Only return when return_index is True. A 2-D LoDTensor\n        with shape [No, 1] represents the selected index which type is Integer.\n        The index is the absolute value cross batches. No is the same number\n        as Out. If the index is used to gather other attribute such as age,\n        one needs to reshape the input(N, M, 1) to (N * M, 1) as first, where\n        N is the batch size and M is the number of boxes.\n\n\n    Examples:\n        .. code-block:: python\n\n            import paddle.fluid as fluid\n\n            pb = fluid.data(name='prior_box', shape=[10, 4], dtype='float32')\n            pbv = fluid.data(name='prior_box_var', shape=[10, 4], dtype='float32')\n            loc = fluid.data(name='target_box', shape=[2, 21, 4], dtype='float32')\n            scores = fluid.data(name='scores', shape=[2, 21, 10], dtype='float32')\n            nmsed_outs, index = fluid.layers.detection_output(scores=scores,\n                                       loc=loc,\n                                       prior_box=pb,\n                                       prior_box_var=pbv,\n                                       return_index=True)\n    "
    helper = LayerHelper('detection_output', **locals())
    decoded_box = box_coder(prior_box=prior_box, prior_box_var=prior_box_var, target_box=loc, code_type='decode_center_size')
    scores = nn.softmax(input=scores)
    scores = nn.transpose(scores, perm=[0, 2, 1])
    scores.stop_gradient = True
    nmsed_outs = helper.create_variable_for_type_inference(dtype=decoded_box.dtype)
    if return_index:
        index = helper.create_variable_for_type_inference(dtype='int')
        helper.append_op(type='multiclass_nms2', inputs={'Scores': scores, 'BBoxes': decoded_box}, outputs={'Out': nmsed_outs, 'Index': index}, attrs={'background_label': 0, 'nms_threshold': nms_threshold, 'nms_top_k': nms_top_k, 'keep_top_k': keep_top_k, 'score_threshold': score_threshold, 'nms_eta': 1.0})
        index.stop_gradient = True
    else:
        helper.append_op(type='multiclass_nms', inputs={'Scores': scores, 'BBoxes': decoded_box}, outputs={'Out': nmsed_outs}, attrs={'background_label': 0, 'nms_threshold': nms_threshold, 'nms_top_k': nms_top_k, 'keep_top_k': keep_top_k, 'score_threshold': score_threshold, 'nms_eta': 1.0})
    nmsed_outs.stop_gradient = True
    if return_index:
        return (nmsed_outs, index)
    return nmsed_outs