import torch
from typing import Sequence


def mirror(data: torch.Tensor, dims: Sequence[int]) -> torch.Tensor:
    """
    Mirror data at dims

    Args
        data: input data [N, C, spatial dims]
        dims: dimensions to mirror starting from spatial dims
            e.g. dim=(0,) mirror the first spatial dimension

    Returns
        torch.Tensor: tensor with mirrored dimensions
    """
    dims = [d + 2 for d in dims]
    return data.flip(dims)