import torch


def decode_delta(delta: torch.Tensor, anchor_mesh: torch.Tensor) -> torch.Tensor:
    """Converts raw output to (x, y, w, h) format where (x, y) is the center,
    w is the width, and h is the height of the bounding box.

    Args:
        delta (torch.Tensor): Raw output from the YOLOLayer.
        anchor_mesh (torch.Tensor): Tensor containing the grid points and their
            respective anchor offsets.

    Returns:
        (torch.Tensor): Decoded bounding box tensor.
    """
    delta[..., :2] = delta[..., :2] * anchor_mesh[..., 2:] + anchor_mesh[..., :2]
    delta[..., 2:] = torch.exp(delta[..., 2:]) * anchor_mesh[..., 2:]
    return delta