def integral_image(image: Tensor) -> Tensor:
    r"""Calculate integral of the input image tensor.

    This particular version sums over the last two dimensions.

    Args:
        image: the input image tensor with shape :math:`(*, H, W)`.

    Returns:
        Integral tensor for the input image tensor with shape :math:`(*, H, W)`.

    Examples:
        >>> input = torch.ones(1, 5, 5)
        >>> output = integral_image(input)
        >>> output
        tensor([[[ 1.,  2.,  3.,  4.,  5.],
                 [ 2.,  4.,  6.,  8., 10.],
                 [ 3.,  6.,  9., 12., 15.],
                 [ 4.,  8., 12., 16., 20.],
                 [ 5., 10., 15., 20., 25.]]])

    """
    KORNIA_CHECK_SHAPE(image, ["*", "H", "W"])

    return integral_tensor(image, (-2, -1))
Calculate integral of the input image tensor.

    This particular version sums over the last two dimensions.

    Args:
        image: the input image tensor with shape :math:`(*, H, W)`.

    Returns:
        Integral tensor for the input image tensor with shape :math:`(*, H, W)`.

    Examples:
        >>> input = torch.ones(1, 5, 5)
        >>> output = integral_image(input)
        >>> output
        tensor([[[ 1.,  2.,  3.,  4.,  5.],
                 [ 2.,  4.,  6.,  8., 10.],
                 [ 3.,  6.,  9., 12., 15.],
                 [ 4.,  8., 12., 16., 20.],
                 [ 5., 10., 15., 20., 25.]]])

    
kornia/enhance/integral.py