import torch


def loss_bbox_regression(offsets, gt_offsets):
    """
    Use sum-squared error as in YOLO.

    @Params:
    -------
    offsets (tensor):
        Predicted bbox offsets of shape [M, 4].
    gt_offsets (tensor):
        GT bbox offsets of shape [M, 4].

    @Returns:
    -------
    loss_bbox_reg (scalar tensor):
        Loss of bbox regression.
    """
    return torch.mean(torch.sum((offsets - gt_offsets)**2, dim=1))