import torch


def tlbr2cthw(boxes):
    """
    Convert top/left bottom/right format `boxes` to center/size corners."
    :param boxes: bounding boxes
    :return: bounding boxes
    """
    center = (boxes[..., :2] + boxes[..., 2:])/2
    sizes = boxes[..., 2:] - boxes[..., :2]
    return torch.cat([center, sizes], dim=-1)