def get_conv_gradweights_shape_1axis(image_shape, top_shape, border_mode, subsample, dilation):
 if (None in [image_shape, top_shape, border_mode, subsample, dilation]):
  return None
 if ((subsample != 1) or (border_mode == 'half')):
  return None
 if (border_mode == 'full'):
  kernel_shape = (top_shape - image_shape)
 elif (border_mode == 'valid'):
  kernel_shape = (image_shape - top_shape)
 else:
  if (border_mode < 0):
   raise ValueError('border_mode must be >= 0')
  kernel_shape = ((image_shape + (2 * border_mode)) - top_shape)
 if (dilation > 1):
  kernel_shape = (kernel_shape / dilation)
 return (kernel_shape + 1)

def get_conv_gradweights_shape_1axis ( image_shape , top_shape , border_mode , subsample , dilation ) : if ( None in [ image_shape , top_shape , border_mode , subsample , dilation ] ) : return None if ( ( subsample != 1 ) or ( border_mode == 'half' ) ) : return None if ( border_mode == 'full' ) : kernel_shape = ( top_shape - image_shape ) elif ( border_mode == 'valid' ) : kernel_shape = ( image_shape - top_shape ) else : if ( border_mode < 0 ) : raise ValueError ( 'border_mode must be >= 0' ) kernel_shape = ( ( image_shape + ( 2 * border_mode ) ) - top_shape ) if ( dilation > 1 ) : kernel_shape = ( kernel_shape / dilation ) return ( kernel_shape + 1 )
this function tries to compute the image shape of convolution gradweights .