import torch


def loss_conf_scores_regression(conf_score, gt_conf_scores):
    """
    Use sum-squared error as in YOLO.

    @Params:
    -------
    conf_score (tensor):
        Predicted confidence score of shape [2M].
    gt_conf_scores (tensor):
        GT conf scores of shape [M].

    @Returns:
    -------
    loss_conf_score (scalar tensor):
       Loss of confidence score.
    """
    # The target conf score are always 1's for positives and 0's for negatives
    gt_conf_scores = torch.cat([torch.ones_like(gt_conf_scores), torch.zeros_like(gt_conf_scores)])
    return torch.mean((conf_score - gt_conf_scores) ** 2)