import torch


def iou_width_height(boxes1, boxes2):
    """
    Parameters:
        boxes1 : tensor
                width and height of the first bounding boxes
        boxes2 : tensor
                width and height of the second bounding boxes
    Returns:
        tensor
        Intersection over union of the corresponding boxes
    """
    intersection = torch.min(boxes1[..., 0], boxes2[..., 0]) * torch.min(
        boxes1[..., 1], boxes2[..., 1]
    )
    union = (
            boxes1[..., 0] * boxes1[..., 1] + boxes2[..., 0] * boxes2[..., 1] - intersection
    )
    return intersection / union