import torch


def average_pooling_rd(
    input: torch.Tensor,
    kernel_size: int,
    stride: int,
    padding: int = 1,
) -> torch.Tensor:
    """
    Performs average-pooling on a tensor in Rd.
    """
    out = torch.nn.functional.avg_pool2d(
        input, kernel_size=kernel_size, stride=stride, padding=padding
    )
    return out