def sub_kernel(kernel, dim1, dim2):
    """
    Constructs a sub-kernel of a kernel.

    Args:
        kernel (tensor) : kernel matrix
        dim1 (tuple) : start, end
        dim2 (tuple) : start, end
    """

    sub_kernel = kernel[dim1[0]:dim1[1],dim2[0]:dim2[1]]
    return sub_kernel