@templatedoc(op_type='yolov3_loss')
def yolov3_loss(x, gt_box, gt_label, anchors, anchor_mask, class_num, ignore_thresh, downsample_ratio, gt_score=None, use_label_smooth=True, name=None, scale_x_y=1.0):
    "\n\t:alias_main: paddle.nn.functional.yolov3_loss\n\t:alias: paddle.nn.functional.yolov3_loss,paddle.nn.functional.vision.yolov3_loss\n\t:old_api: paddle.fluid.layers.yolov3_loss\n\n    ${comment}\n\n    Args:\n        x (Variable): ${x_comment}The data type is float32 or float64. \n        gt_box (Variable): groud truth boxes, should be in shape of [N, B, 4],\n                          in the third dimension, x, y, w, h should be stored. \n                          x,y is the center coordinate of boxes, w, h are the\n                          width and height, x, y, w, h should be divided by \n                          input image height to scale to [0, 1].\n                          N is the batch number and B is the max box number in \n                          an image.The data type is float32 or float64. \n        gt_label (Variable): class id of ground truth boxes, should be in shape\n                            of [N, B].The data type is int32. \n        anchors (list|tuple): ${anchors_comment}\n        anchor_mask (list|tuple): ${anchor_mask_comment}\n        class_num (int): ${class_num_comment}\n        ignore_thresh (float): ${ignore_thresh_comment}\n        downsample_ratio (int): ${downsample_ratio_comment}\n        name (string): The default value is None.  Normally there is no need \n                       for user to set this property.  For more information, \n                       please refer to :ref:`api_guide_Name`\n        gt_score (Variable): mixup score of ground truth boxes, should be in shape\n                            of [N, B]. Default None.\n        use_label_smooth (bool): ${use_label_smooth_comment}\n        scale_x_y (float): ${scale_x_y_comment}\n\n    Returns:\n        Variable: A 1-D tensor with shape [N], the value of yolov3 loss\n\n    Raises:\n        TypeError: Input x of yolov3_loss must be Variable\n        TypeError: Input gtbox of yolov3_loss must be Variable\n        TypeError: Input gtlabel of yolov3_loss must be Variable\n        TypeError: Input gtscore of yolov3_loss must be None or Variable\n        TypeError: Attr anchors of yolov3_loss must be list or tuple\n        TypeError: Attr class_num of yolov3_loss must be an integer\n        TypeError: Attr ignore_thresh of yolov3_loss must be a float number\n        TypeError: Attr use_label_smooth of yolov3_loss must be a bool value\n\n    Examples:\n      .. code-block:: python\n\n          import paddle.fluid as fluid\n          x = fluid.data(name='x', shape=[None, 255, 13, 13], dtype='float32')\n          gt_box = fluid.data(name='gt_box', shape=[None, 6, 4], dtype='float32')\n          gt_label = fluid.data(name='gt_label', shape=[None, 6], dtype='int32')\n          gt_score = fluid.data(name='gt_score', shape=[None, 6], dtype='float32')\n          anchors = [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326]\n          anchor_mask = [0, 1, 2]\n          loss = fluid.layers.yolov3_loss(x=x, gt_box=gt_box, gt_label=gt_label,\n                                          gt_score=gt_score, anchors=anchors, \n                                          anchor_mask=anchor_mask, class_num=80,\n                                          ignore_thresh=0.7, downsample_ratio=32)\n    "
    helper = LayerHelper('yolov3_loss', **locals())
    if (not isinstance(x, Variable)):
        raise TypeError('Input x of yolov3_loss must be Variable')
    if (not isinstance(gt_box, Variable)):
        raise TypeError('Input gtbox of yolov3_loss must be Variable')
    if (not isinstance(gt_label, Variable)):
        raise TypeError('Input gtlabel of yolov3_loss must be Variable')
    if ((gt_score is not None) and (not isinstance(gt_score, Variable))):
        raise TypeError('Input gtscore of yolov3_loss must be Variable')
    if ((not isinstance(anchors, list)) and (not isinstance(anchors, tuple))):
        raise TypeError('Attr anchors of yolov3_loss must be list or tuple')
    if ((not isinstance(anchor_mask, list)) and (not isinstance(anchor_mask, tuple))):
        raise TypeError('Attr anchor_mask of yolov3_loss must be list or tuple')
    if (not isinstance(class_num, int)):
        raise TypeError('Attr class_num of yolov3_loss must be an integer')
    if (not isinstance(ignore_thresh, float)):
        raise TypeError('Attr ignore_thresh of yolov3_loss must be a float number')
    if (not isinstance(use_label_smooth, bool)):
        raise TypeError('Attr use_label_smooth of yolov3_loss must be a bool value')
    loss = helper.create_variable_for_type_inference(dtype=x.dtype)
    objectness_mask = helper.create_variable_for_type_inference(dtype='int32')
    gt_match_mask = helper.create_variable_for_type_inference(dtype='int32')
    inputs = {'X': x, 'GTBox': gt_box, 'GTLabel': gt_label}
    if (gt_score is not None):
        inputs['GTScore'] = gt_score
    attrs = {'anchors': anchors, 'anchor_mask': anchor_mask, 'class_num': class_num, 'ignore_thresh': ignore_thresh, 'downsample_ratio': downsample_ratio, 'use_label_smooth': use_label_smooth, 'scale_x_y': scale_x_y}
    helper.append_op(type='yolov3_loss', inputs=inputs, outputs={'Loss': loss, 'ObjectnessMask': objectness_mask, 'GTMatchMask': gt_match_mask}, attrs=attrs)
    return loss
:alias_main: paddle.nn.functional.yolov3_loss
    :alias: paddle.nn.functional.yolov3_loss,paddle.nn.functional.vision.yolov3_loss
    :old_api: paddle.fluid.layers.yolov3_loss

${comment}

Args:
    x (Variable): ${x_comment}The data type is float32 or float64. 
    gt_box (Variable): groud truth boxes, should be in shape of [N, B, 4],
                      in the third dimension, x, y, w, h should be stored. 
                      x,y is the center coordinate of boxes, w, h are the
                      width and height, x, y, w, h should be divided by 
                      input image height to scale to [0, 1].
                      N is the batch number and B is the max box number in 
                      an image.The data type is float32 or float64. 
    gt_label (Variable): class id of ground truth boxes, should be in shape
                        of [N, B].The data type is int32. 
    anchors (list|tuple): ${anchors_comment}
    anchor_mask (list|tuple): ${anchor_mask_comment}
    class_num (int): ${class_num_comment}
    ignore_thresh (float): ${ignore_thresh_comment}
    downsample_ratio (int): ${downsample_ratio_comment}
    name (string): The default value is None.  Normally there is no need 
                   for user to set this property.  For more information, 
                   please refer to :ref:`api_guide_Name`
    gt_score (Variable): mixup score of ground truth boxes, should be in shape
                        of [N, B]. Default None.
    use_label_smooth (bool): ${use_label_smooth_comment}
    scale_x_y (float): ${scale_x_y_comment}

Returns:
    Variable: A 1-D tensor with shape [N], the value of yolov3 loss

Raises:
    TypeError: Input x of yolov3_loss must be Variable
    TypeError: Input gtbox of yolov3_loss must be Variable
    TypeError: Input gtlabel of yolov3_loss must be Variable
    TypeError: Input gtscore of yolov3_loss must be None or Variable
    TypeError: Attr anchors of yolov3_loss must be list or tuple
    TypeError: Attr class_num of yolov3_loss must be an integer
    TypeError: Attr ignore_thresh of yolov3_loss must be a float number
    TypeError: Attr use_label_smooth of yolov3_loss must be a bool value

Examples:
  .. code-block:: python

      import paddle.fluid as fluid
      x = fluid.data(name='x', shape=[None, 255, 13, 13], dtype='float32')
      gt_box = fluid.data(name='gt_box', shape=[None, 6, 4], dtype='float32')
      gt_label = fluid.data(name='gt_label', shape=[None, 6], dtype='int32')
      gt_score = fluid.data(name='gt_score', shape=[None, 6], dtype='float32')
      anchors = [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326]
      anchor_mask = [0, 1, 2]
      loss = fluid.layers.yolov3_loss(x=x, gt_box=gt_box, gt_label=gt_label,
                                      gt_score=gt_score, anchors=anchors, 
                                      anchor_mask=anchor_mask, class_num=80,
                                      ignore_thresh=0.7, downsample_ratio=32)
@templatedoc(op_type='yolov3_loss')
def yolov3_loss(x, gt_box, gt_label, anchors, anchor_mask, class_num, ignore_thresh, downsample_ratio, gt_score=None, use_label_smooth=True, name=None, scale_x_y=1.0):
    "\n\t:alias_main: paddle.nn.functional.yolov3_loss\n\t:alias: paddle.nn.functional.yolov3_loss,paddle.nn.functional.vision.yolov3_loss\n\t:old_api: paddle.fluid.layers.yolov3_loss\n\n    ${comment}\n\n    Args:\n        x (Variable): ${x_comment}The data type is float32 or float64. \n        gt_box (Variable): groud truth boxes, should be in shape of [N, B, 4],\n                          in the third dimension, x, y, w, h should be stored. \n                          x,y is the center coordinate of boxes, w, h are the\n                          width and height, x, y, w, h should be divided by \n                          input image height to scale to [0, 1].\n                          N is the batch number and B is the max box number in \n                          an image.The data type is float32 or float64. \n        gt_label (Variable): class id of ground truth boxes, should be in shape\n                            of [N, B].The data type is int32. \n        anchors (list|tuple): ${anchors_comment}\n        anchor_mask (list|tuple): ${anchor_mask_comment}\n        class_num (int): ${class_num_comment}\n        ignore_thresh (float): ${ignore_thresh_comment}\n        downsample_ratio (int): ${downsample_ratio_comment}\n        name (string): The default value is None.  Normally there is no need \n                       for user to set this property.  For more information, \n                       please refer to :ref:`api_guide_Name`\n        gt_score (Variable): mixup score of ground truth boxes, should be in shape\n                            of [N, B]. Default None.\n        use_label_smooth (bool): ${use_label_smooth_comment}\n        scale_x_y (float): ${scale_x_y_comment}\n\n    Returns:\n        Variable: A 1-D tensor with shape [N], the value of yolov3 loss\n\n    Raises:\n        TypeError: Input x of yolov3_loss must be Variable\n        TypeError: Input gtbox of yolov3_loss must be Variable\n        TypeError: Input gtlabel of yolov3_loss must be Variable\n        TypeError: Input gtscore of yolov3_loss must be None or Variable\n        TypeError: Attr anchors of yolov3_loss must be list or tuple\n        TypeError: Attr class_num of yolov3_loss must be an integer\n        TypeError: Attr ignore_thresh of yolov3_loss must be a float number\n        TypeError: Attr use_label_smooth of yolov3_loss must be a bool value\n\n    Examples:\n      .. code-block:: python\n\n          import paddle.fluid as fluid\n          x = fluid.data(name='x', shape=[None, 255, 13, 13], dtype='float32')\n          gt_box = fluid.data(name='gt_box', shape=[None, 6, 4], dtype='float32')\n          gt_label = fluid.data(name='gt_label', shape=[None, 6], dtype='int32')\n          gt_score = fluid.data(name='gt_score', shape=[None, 6], dtype='float32')\n          anchors = [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326]\n          anchor_mask = [0, 1, 2]\n          loss = fluid.layers.yolov3_loss(x=x, gt_box=gt_box, gt_label=gt_label,\n                                          gt_score=gt_score, anchors=anchors, \n                                          anchor_mask=anchor_mask, class_num=80,\n                                          ignore_thresh=0.7, downsample_ratio=32)\n    "
    helper = LayerHelper('yolov3_loss', **locals())
    if (not isinstance(x, Variable)):
        raise TypeError('Input x of yolov3_loss must be Variable')
    if (not isinstance(gt_box, Variable)):
        raise TypeError('Input gtbox of yolov3_loss must be Variable')
    if (not isinstance(gt_label, Variable)):
        raise TypeError('Input gtlabel of yolov3_loss must be Variable')
    if ((gt_score is not None) and (not isinstance(gt_score, Variable))):
        raise TypeError('Input gtscore of yolov3_loss must be Variable')
    if ((not isinstance(anchors, list)) and (not isinstance(anchors, tuple))):
        raise TypeError('Attr anchors of yolov3_loss must be list or tuple')
    if ((not isinstance(anchor_mask, list)) and (not isinstance(anchor_mask, tuple))):
        raise TypeError('Attr anchor_mask of yolov3_loss must be list or tuple')
    if (not isinstance(class_num, int)):
        raise TypeError('Attr class_num of yolov3_loss must be an integer')
    if (not isinstance(ignore_thresh, float)):
        raise TypeError('Attr ignore_thresh of yolov3_loss must be a float number')
    if (not isinstance(use_label_smooth, bool)):
        raise TypeError('Attr use_label_smooth of yolov3_loss must be a bool value')
    loss = helper.create_variable_for_type_inference(dtype=x.dtype)
    objectness_mask = helper.create_variable_for_type_inference(dtype='int32')
    gt_match_mask = helper.create_variable_for_type_inference(dtype='int32')
    inputs = {'X': x, 'GTBox': gt_box, 'GTLabel': gt_label}
    if (gt_score is not None):
        inputs['GTScore'] = gt_score
    attrs = {'anchors': anchors, 'anchor_mask': anchor_mask, 'class_num': class_num, 'ignore_thresh': ignore_thresh, 'downsample_ratio': downsample_ratio, 'use_label_smooth': use_label_smooth, 'scale_x_y': scale_x_y}
    helper.append_op(type='yolov3_loss', inputs=inputs, outputs={'Loss': loss, 'ObjectnessMask': objectness_mask, 'GTMatchMask': gt_match_mask}, attrs=attrs)
    return loss