human
Complete this python program:
def check_conv_gradinputs_shape(image_shape, kernel_shape, output_shape, border_mode, subsample, filter_dilation=None):
assistant
#Here is the Python program you requested.

    """This function checks if the given image shapes are consistent.
    Parameters
    image_shape: tuple of int (symbolic or numeric) corresponding to the input
    image shape. Its four (or five) element must correspond respectively
    to: batch size, number of input channels, height and width (and
    possibly depth) of the image. None where undefined.
    kernel_shape: tuple of int (symbolic or numeric) corresponding to the
    kernel shape. Its four (or five) elements must correspond respectively
    to: number of output channels, number of input channels, height and
    width (and possibly depth) of the kernel. None where undefined.
    output_shape: tuple of int (symbolic or numeric) corresponding to the
    output shape. Its four (or five) elements must correspond respectively
    to: batch size, number of output channels, height and width
    (and possibly depth) of the output. None where undefined.
    border_mode: string, int (symbolic or numeric) or tuple of int (symbolic
    or numeric). If it is a string, it must be \valid\, \half\ or \full\.
    If it is a tuple, its two (or three) elements respectively correspond
    to the padding on height and width (and possibly depth) axis.
    subsample: tuple of int (symbolic or numeric). Its two or three elements
    respectively correspond to the subsampling on height and width (and
    possibly depth) axis.
    filter_dilation: tuple of int (symbolic or numeric). Its two or three
    elements correspond respectively to the dilation on height and
    width axis.
    Returns
    Returns False if a convolution with the given input shape, kernel shape
    and parameters would not have produced the given output shape.
    Returns True in all other cases: if the given output shape matches the
    computed output shape, but also if the shape could not be checked because
    because the shape contains symbolic values.
    """
    image_shape = tuple(image_shape)
    kernel_shape = tuple(kernel_shape)
    output_shape = tuple(output_shape)
    if ((len(image_shape) != len(kernel_shape)) or (len(image_shape) != len(output_shape))):
        return False
    if ((len(image_shape) - 2) != len(subsample)):
        return False
    if ((filter_dilation is not None) and ((len(image_shape) - 2) != len(filter_dilation))):
        return False
    computed_output_shape = get_conv_output_shape(image_shape, kernel_shape, border_mode, subsample, filter_dilation)
    def check_dim(given, computed):
        if ((given is None) or (computed is None)):
            return True
        try:
            given = get_scalar_constant_value(given)
            computed = get_scalar_constant_value(computed)
            return (int(given) == int(computed))
        except NotScalarConstantError:
            return True
    return all((check_dim(given, computed) for (given, computed) in zip(output_shape, computed_output_shape)))