def delta2bbox_v2(deltas,
                  boxes,
                  delta_mean=[0.0, 0.0, 0.0, 0.0],
                  delta_std=[1.0, 1.0, 1.0, 1.0],
                  max_shape=None,
                  ctr_clip=32.0):
    """Decode deltas to bboxes.
    Modified from delta2bbox() which just use weight parameters to be divided by deltas.
    Used in YOLOFHead.
    Note: return tensor shape [n,1,4]
        If you want to add a reshape, please add after the calling code instead of here.
    """
    clip_scale = math.log(1000.0 / 16)

    widths = boxes[:, 2] - boxes[:, 0]
    heights = boxes[:, 3] - boxes[:, 1]
    ctr_x = boxes[:, 0] + 0.5 * widths
    ctr_y = boxes[:, 1] + 0.5 * heights

    deltas = deltas * paddle.to_tensor(delta_std) + paddle.to_tensor(delta_mean)
    dx = deltas[:, 0::4]
    dy = deltas[:, 1::4]
    dw = deltas[:, 2::4]
    dh = deltas[:, 3::4]

    # Prevent sending too large values into paddle.exp()
    dx = dx * widths.unsqueeze(1)
    dy = dy * heights.unsqueeze(1)
    if ctr_clip is not None:
        dx = paddle.clip(dx, max=ctr_clip, min=-ctr_clip)
        dy = paddle.clip(dy, max=ctr_clip, min=-ctr_clip)
        dw = paddle.clip(dw, max=clip_scale)
        dh = paddle.clip(dh, max=clip_scale)
    else:
        dw = dw.clip(min=-clip_scale, max=clip_scale)
        dh = dh.clip(min=-clip_scale, max=clip_scale)

    pred_ctr_x = dx + ctr_x.unsqueeze(1)
    pred_ctr_y = dy + ctr_y.unsqueeze(1)
    pred_w = paddle.exp(dw) * widths.unsqueeze(1)
    pred_h = paddle.exp(dh) * heights.unsqueeze(1)

    pred_boxes = []
    pred_boxes.append(pred_ctr_x - 0.5 * pred_w)
    pred_boxes.append(pred_ctr_y - 0.5 * pred_h)
    pred_boxes.append(pred_ctr_x + 0.5 * pred_w)
    pred_boxes.append(pred_ctr_y + 0.5 * pred_h)
    pred_boxes = paddle.stack(pred_boxes, axis=-1)

    if max_shape is not None:
        pred_boxes[..., 0::2] = pred_boxes[..., 0::2].clip(
            min=0, max=max_shape[1])
        pred_boxes[..., 1::2] = pred_boxes[..., 1::2].clip(
            min=0, max=max_shape[0])
    return pred_boxes
Decode deltas to bboxes.
    Modified from delta2bbox() which just use weight parameters to be divided by deltas.
    Used in YOLOFHead.
    Note: return tensor shape [n,1,4]
        If you want to add a reshape, please add after the calling code instead of here.
    
ppdet/modeling/bbox_utils.py