def get_conv_gradinputs_shape(kernel_shape, top_shape, border_mode, subsample, filter_dilation=None):
 (bsize, topshp) = (top_shape[0], top_shape[2:])
 (nkern, kshp) = (kernel_shape[1], kernel_shape[2:])
 if (filter_dilation is None):
  filter_dilation = numpy.ones(len(subsample), dtype='int')
 if isinstance(border_mode, tuple):
  out_shp = tuple((get_conv_gradinputs_shape_1axis(kshp[i], topshp[i], border_mode[i], subsample[i], filter_dilation[i]) for i in range(len(subsample))))
 else:
  out_shp = tuple((get_conv_gradinputs_shape_1axis(kshp[i], topshp[i], border_mode, subsample[i], filter_dilation[i]) for i in range(len(subsample))))
 return ((bsize, nkern) + out_shp)

def get_conv_gradinputs_shape ( kernel_shape , top_shape , border_mode , subsample , filter_dilation = None ) : ( bsize , topshp ) = ( top_shape [ 0 ] , top_shape [ 2 : ] ) ( nkern , kshp ) = ( kernel_shape [ 1 ] , kernel_shape [ 2 : ] ) if ( filter_dilation is None ) : filter_dilation = numpy . ones ( len ( subsample ) , dtype = 'int' ) if isinstance ( border_mode , tuple ) : out_shp = tuple ( ( get_conv_gradinputs_shape_1axis ( kshp [ i ] , topshp [ i ] , border_mode [ i ] , subsample [ i ] , filter_dilation [ i ] ) for i in range ( len ( subsample ) ) ) ) else : out_shp = tuple ( ( get_conv_gradinputs_shape_1axis ( kshp [ i ] , topshp [ i ] , border_mode , subsample [ i ] , filter_dilation [ i ] ) for i in range ( len ( subsample ) ) ) ) return ( ( bsize , nkern ) + out_shp )
this function tries to compute the image shape of convolution gradinputs .