def check_conv_gradinputs_shape(image_shape, kernel_shape, output_shape, border_mode, subsample, filter_dilation=None):
 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)))

def check_conv_gradinputs_shape ( image_shape , kernel_shape , output_shape , border_mode , subsample , filter_dilation = None ) : 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 ) ) )
this function checks if the given image shapes are consistent .