import torch


def relative_aspect_ratio(input_tensor: torch.Tensor, output_tensor: torch.Tensor):
    """Compute the relative aspect ratio between two tensors.
    Args:
        * input_tensor: The [..., Hi, Wi] input tensor.
        * output_tensor: The [..., Hj, Wj] output tensor.
    Returns:
        * ratio: The [2 x 1] relative aspect ratio.
    """
    i_height, i_width = input_tensor.shape[-2:]
    o_height, o_width = output_tensor.shape[-2:]
    return torch.tensor(
        [
            [
                float(o_width) / float(i_width),
                float(o_height) / float(i_height),
            ]
        ],
        dtype=torch.float32,
    )