def matrix_nms(bboxes, scores, score_threshold, post_threshold, nms_top_k, keep_top_k, use_gaussian=False, gaussian_sigma=2.0, background_label=0, normalized=True, return_index=False, name=None):
    "\n    **Matrix NMS**\n\n    This operator does matrix non maximum suppression (NMS).\n\n    First selects a subset of candidate bounding boxes that have higher scores\n    than score_threshold (if provided), then the top k candidate is selected if\n    nms_top_k is larger than -1. Score of the remaining candidate are then\n    decayed according to the Matrix NMS scheme.\n    Aftern NMS step, at most keep_top_k number of total bboxes are to be kept\n    per image if keep_top_k is larger than -1.\n\n    Args:\n        bboxes (Variable): A 3-D Tensor with shape [N, M, 4] represents the\n                           predicted locations of M bounding bboxes,\n                           N is the batch size. Each bounding box has four\n                           coordinate values and the layout is\n                           [xmin, ymin, xmax, ymax], when box size equals to 4.\n                           The data type is float32 or float64.\n        scores (Variable): A 3-D Tensor with shape [N, C, M]\n                           represents the predicted confidence predictions.\n                           N is the batch size, C is the class number, M is\n                           number of bounding boxes. For each category there\n                           are total M scores which corresponding M bounding\n                           boxes. Please note, M is equal to the 2nd dimension\n                           of BBoxes. The data type is float32 or float64.\n        score_threshold (float): Threshold to filter out bounding boxes with\n                                 low confidence score.\n        post_threshold (float): Threshold to filter out bounding boxes with\n                                low confidence score AFTER decaying.\n        nms_top_k (int): Maximum number of detections to be kept according to\n                         the confidences after the filtering detections based\n                         on score_threshold.\n        keep_top_k (int): Number of total bboxes to be kept per image after NMS\n                          step. -1 means keeping all bboxes after NMS step.\n        use_gaussian (bool): Use Gaussian as the decay function. Default: False\n        gaussian_sigma (float): Sigma for Gaussian decay function. Default: 2.0\n        background_label (int): The index of background label, the background\n                                label will be ignored. If set to -1, then all\n                                categories will be considered. Default: 0\n        normalized (bool): Whether detections are normalized. Default: True\n        return_index(bool): Whether return selected index. Default: False\n        name(str): Name of the matrix nms op. Default: None.\n\n    Returns:\n        A tuple with two Variables: (Out, Index) if return_index is True,\n        otherwise, one Variable(Out) is returned.\n\n        Out (Variable): A 2-D LoDTensor with shape [No, 6] containing the\n             detection results.\n             Each row has 6 values: [label, confidence, xmin, ymin, xmax, ymax]\n             (After version 1.3, when no boxes detected, the lod is changed\n             from {0} to {1})\n\n        Index (Variable): A 2-D LoDTensor with shape [No, 1] containing the\n            selected indices, which are absolute values cross batches.\n\n    Examples:\n        .. code-block:: python\n\n\n            import paddle.fluid as fluid\n            boxes = fluid.data(name='bboxes', shape=[None,81, 4],\n                                      dtype='float32', lod_level=1)\n            scores = fluid.data(name='scores', shape=[None,81],\n                                      dtype='float32', lod_level=1)\n            out = fluid.layers.matrix_nms(bboxes=boxes,\n                                          scores=scores,\n                                          background_label=0,\n                                          score_threshold=0.5,\n                                          post_threshold=0.1,\n                                          nms_top_k=400,\n                                          keep_top_k=200,\n                                          normalized=False)\n    "
    check_variable_and_dtype(bboxes, 'BBoxes', ['float32', 'float64'], 'matrix_nms')
    check_variable_and_dtype(scores, 'Scores', ['float32', 'float64'], 'matrix_nms')
    check_type(score_threshold, 'score_threshold', float, 'matrix_nms')
    check_type(post_threshold, 'post_threshold', float, 'matrix_nms')
    check_type(nms_top_k, 'nums_top_k', int, 'matrix_nms')
    check_type(keep_top_k, 'keep_top_k', int, 'matrix_nms')
    check_type(normalized, 'normalized', bool, 'matrix_nms')
    check_type(use_gaussian, 'use_gaussian', bool, 'matrix_nms')
    check_type(gaussian_sigma, 'gaussian_sigma', float, 'matrix_nms')
    check_type(background_label, 'background_label', int, 'matrix_nms')
    helper = LayerHelper('matrix_nms', **locals())
    output = helper.create_variable_for_type_inference(dtype=bboxes.dtype)
    index = helper.create_variable_for_type_inference(dtype='int')
    helper.append_op(type='matrix_nms', inputs={'BBoxes': bboxes, 'Scores': scores}, attrs={'background_label': background_label, 'score_threshold': score_threshold, 'post_threshold': post_threshold, 'nms_top_k': nms_top_k, 'gaussian_sigma': gaussian_sigma, 'use_gaussian': use_gaussian, 'keep_top_k': keep_top_k, 'normalized': normalized}, outputs={'Out': output, 'Index': index})
    output.stop_gradient = True
    if return_index:
        return (output, index)
    else:
        return output
**Matrix NMS**

This operator does matrix non maximum suppression (NMS).

First selects a subset of candidate bounding boxes that have higher scores
than score_threshold (if provided), then the top k candidate is selected if
nms_top_k is larger than -1. Score of the remaining candidate are then
decayed according to the Matrix NMS scheme.
Aftern NMS step, at most keep_top_k number of total bboxes are to be kept
per image if keep_top_k is larger than -1.

Args:
    bboxes (Variable): A 3-D Tensor with shape [N, M, 4] represents the
                       predicted locations of M bounding bboxes,
                       N is the batch size. Each bounding box has four
                       coordinate values and the layout is
                       [xmin, ymin, xmax, ymax], when box size equals to 4.
                       The data type is float32 or float64.
    scores (Variable): A 3-D Tensor with shape [N, C, M]
                       represents the predicted confidence predictions.
                       N is the batch size, C is the class number, M is
                       number of bounding boxes. For each category there
                       are total M scores which corresponding M bounding
                       boxes. Please note, M is equal to the 2nd dimension
                       of BBoxes. The data type is float32 or float64.
    score_threshold (float): Threshold to filter out bounding boxes with
                             low confidence score.
    post_threshold (float): Threshold to filter out bounding boxes with
                            low confidence score AFTER decaying.
    nms_top_k (int): Maximum number of detections to be kept according to
                     the confidences after the filtering detections based
                     on score_threshold.
    keep_top_k (int): Number of total bboxes to be kept per image after NMS
                      step. -1 means keeping all bboxes after NMS step.
    use_gaussian (bool): Use Gaussian as the decay function. Default: False
    gaussian_sigma (float): Sigma for Gaussian decay function. Default: 2.0
    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
    normalized (bool): Whether detections are normalized. Default: True
    return_index(bool): Whether return selected index. Default: False
    name(str): Name of the matrix nms op. Default: None.

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

    Out (Variable): A 2-D LoDTensor with shape [No, 6] containing the
         detection results.
         Each row has 6 values: [label, confidence, xmin, ymin, xmax, ymax]
         (After version 1.3, when no boxes detected, the lod is changed
         from {0} to {1})

    Index (Variable): A 2-D LoDTensor with shape [No, 1] containing the
        selected indices, which are absolute values cross batches.

Examples:
    .. code-block:: python


        import paddle.fluid as fluid
        boxes = fluid.data(name='bboxes', shape=[None,81, 4],
                                  dtype='float32', lod_level=1)
        scores = fluid.data(name='scores', shape=[None,81],
                                  dtype='float32', lod_level=1)
        out = fluid.layers.matrix_nms(bboxes=boxes,
                                      scores=scores,
                                      background_label=0,
                                      score_threshold=0.5,
                                      post_threshold=0.1,
                                      nms_top_k=400,
                                      keep_top_k=200,
                                      normalized=False)
def matrix_nms(bboxes, scores, score_threshold, post_threshold, nms_top_k, keep_top_k, use_gaussian=False, gaussian_sigma=2.0, background_label=0, normalized=True, return_index=False, name=None):
    "\n    **Matrix NMS**\n\n    This operator does matrix non maximum suppression (NMS).\n\n    First selects a subset of candidate bounding boxes that have higher scores\n    than score_threshold (if provided), then the top k candidate is selected if\n    nms_top_k is larger than -1. Score of the remaining candidate are then\n    decayed according to the Matrix NMS scheme.\n    Aftern NMS step, at most keep_top_k number of total bboxes are to be kept\n    per image if keep_top_k is larger than -1.\n\n    Args:\n        bboxes (Variable): A 3-D Tensor with shape [N, M, 4] represents the\n                           predicted locations of M bounding bboxes,\n                           N is the batch size. Each bounding box has four\n                           coordinate values and the layout is\n                           [xmin, ymin, xmax, ymax], when box size equals to 4.\n                           The data type is float32 or float64.\n        scores (Variable): A 3-D Tensor with shape [N, C, M]\n                           represents the predicted confidence predictions.\n                           N is the batch size, C is the class number, M is\n                           number of bounding boxes. For each category there\n                           are total M scores which corresponding M bounding\n                           boxes. Please note, M is equal to the 2nd dimension\n                           of BBoxes. The data type is float32 or float64.\n        score_threshold (float): Threshold to filter out bounding boxes with\n                                 low confidence score.\n        post_threshold (float): Threshold to filter out bounding boxes with\n                                low confidence score AFTER decaying.\n        nms_top_k (int): Maximum number of detections to be kept according to\n                         the confidences after the filtering detections based\n                         on score_threshold.\n        keep_top_k (int): Number of total bboxes to be kept per image after NMS\n                          step. -1 means keeping all bboxes after NMS step.\n        use_gaussian (bool): Use Gaussian as the decay function. Default: False\n        gaussian_sigma (float): Sigma for Gaussian decay function. Default: 2.0\n        background_label (int): The index of background label, the background\n                                label will be ignored. If set to -1, then all\n                                categories will be considered. Default: 0\n        normalized (bool): Whether detections are normalized. Default: True\n        return_index(bool): Whether return selected index. Default: False\n        name(str): Name of the matrix nms op. Default: None.\n\n    Returns:\n        A tuple with two Variables: (Out, Index) if return_index is True,\n        otherwise, one Variable(Out) is returned.\n\n        Out (Variable): A 2-D LoDTensor with shape [No, 6] containing the\n             detection results.\n             Each row has 6 values: [label, confidence, xmin, ymin, xmax, ymax]\n             (After version 1.3, when no boxes detected, the lod is changed\n             from {0} to {1})\n\n        Index (Variable): A 2-D LoDTensor with shape [No, 1] containing the\n            selected indices, which are absolute values cross batches.\n\n    Examples:\n        .. code-block:: python\n\n\n            import paddle.fluid as fluid\n            boxes = fluid.data(name='bboxes', shape=[None,81, 4],\n                                      dtype='float32', lod_level=1)\n            scores = fluid.data(name='scores', shape=[None,81],\n                                      dtype='float32', lod_level=1)\n            out = fluid.layers.matrix_nms(bboxes=boxes,\n                                          scores=scores,\n                                          background_label=0,\n                                          score_threshold=0.5,\n                                          post_threshold=0.1,\n                                          nms_top_k=400,\n                                          keep_top_k=200,\n                                          normalized=False)\n    "
    check_variable_and_dtype(bboxes, 'BBoxes', ['float32', 'float64'], 'matrix_nms')
    check_variable_and_dtype(scores, 'Scores', ['float32', 'float64'], 'matrix_nms')
    check_type(score_threshold, 'score_threshold', float, 'matrix_nms')
    check_type(post_threshold, 'post_threshold', float, 'matrix_nms')
    check_type(nms_top_k, 'nums_top_k', int, 'matrix_nms')
    check_type(keep_top_k, 'keep_top_k', int, 'matrix_nms')
    check_type(normalized, 'normalized', bool, 'matrix_nms')
    check_type(use_gaussian, 'use_gaussian', bool, 'matrix_nms')
    check_type(gaussian_sigma, 'gaussian_sigma', float, 'matrix_nms')
    check_type(background_label, 'background_label', int, 'matrix_nms')
    helper = LayerHelper('matrix_nms', **locals())
    output = helper.create_variable_for_type_inference(dtype=bboxes.dtype)
    index = helper.create_variable_for_type_inference(dtype='int')
    helper.append_op(type='matrix_nms', inputs={'BBoxes': bboxes, 'Scores': scores}, attrs={'background_label': background_label, 'score_threshold': score_threshold, 'post_threshold': post_threshold, 'nms_top_k': nms_top_k, 'gaussian_sigma': gaussian_sigma, 'use_gaussian': use_gaussian, 'keep_top_k': keep_top_k, 'normalized': normalized}, outputs={'Out': output, 'Index': index})
    output.stop_gradient = True
    if return_index:
        return (output, index)
    else:
        return output