def _blur_pool_by_kernel2d(input: Tensor, kernel: Tensor, stride: int) -> Tensor:
    """Compute blur_pool by a given :math:`CxC_{out}xNxN` kernel."""
    KORNIA_CHECK(
        len(kernel.shape) == 4 and kernel.shape[-2] == kernel.shape[-1],
        f"Invalid kernel shape. Expect CxC_(out, None)xNxN, Got {kernel.shape}",
    )

    padding = _compute_zero_padding((kernel.shape[-2], kernel.shape[-1]))
    return F.conv2d(input, kernel, padding=padding, stride=stride, groups=input.shape[1])
Compute blur_pool by a given :math:`CxC_{out}xNxN` kernel.
kornia/filters/blur_pool.py