def _max_blur_pool_by_kernel2d(
    input: Tensor, kernel: Tensor, stride: int, max_pool_size: int, ceil_mode: bool
) -> Tensor:
    """Compute max_blur_pool by a given :math:`CxC_(out, None)xNxN` kernel."""
    KORNIA_CHECK(
        len(kernel.shape) == 4 and kernel.shape[-2] == kernel.shape[-1],
        f"Invalid kernel shape. Expect CxC_outxNxN, Got {kernel.shape}",
    )
    # compute local maxima
    input = F.max_pool2d(input, kernel_size=max_pool_size, padding=0, stride=1, ceil_mode=ceil_mode)
    # blur and downsample
    padding = _compute_zero_padding((kernel.shape[-2], kernel.shape[-1]))
    return F.conv2d(input, kernel, padding=padding, stride=stride, groups=input.size(1))
Compute max_blur_pool by a given :math:`CxC_(out, None)xNxN` kernel.
kornia/filters/blur_pool.py