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

def get_conv_shape_1axis ( image_shape , kernel_shape , border_mode , subsample , dilation = 1 ) : if ( None in [ image_shape , kernel_shape , border_mode , subsample , dilation ] ) : return None dil_kernel_shape = ( ( ( kernel_shape - 1 ) * dilation ) + 1 ) if ( border_mode == 'half' ) : pad = ( dil_kernel_shape // 2 ) elif ( border_mode == 'full' ) : pad = ( dil_kernel_shape - 1 ) elif ( border_mode == 'valid' ) : pad = 0 else : pad = border_mode if ( pad < 0 ) : raise ValueError ( 'border_mode must be >= 0' ) if ( pad == 0 ) : out_shp = ( image_shape - dil_kernel_shape ) else : out_shp = ( ( image_shape + ( 2 * pad ) ) - dil_kernel_shape ) if ( subsample != 1 ) : out_shp = ( out_shp // subsample ) out_shp = ( out_shp + 1 ) return out_shp
this function compute the output shape of convolution operation .