def get_loc_offset(box_gt, box_anchor):
    """Computes the offset of a groundtruth box and an anchor box.

    Args:
        box_gt (array): groundtruth box.
        box_anchor (array): anchor box.

    Returns:
        float: offset between x1 coordinate of the two boxes.
        float: offset between y1 coordinate of the two boxes.
        float: offset between x2 coordinate of the two boxes.
        float: offset between y2 coordinate of the two boxes.
    """
    gt_x1, gt_y1, gt_x2, gt_y2 = tuple(box_gt)
    ac_x1, ac_y1, ac_x2, ac_y2 = tuple(box_anchor)
    anchor_width = ac_x2 - ac_x1
    anchor_height = ac_y2 - ac_y1
    dx1 = (gt_x1 - ac_x1) / anchor_width
    dy1 = (gt_y1 - ac_y1) / anchor_height
    dx2 = (gt_x2 - ac_x2) / anchor_width
    dy2 = (gt_y2 - ac_y2) / anchor_height
    return dx1, dy1, dx2, dy2