def deconv(X, w, subsample=(1, 1), border_mode=(0, 0), conv_mode='conv'):
 img = gpu_contiguous(X)
 kerns = gpu_contiguous(w)
 desc = GpuDnnConvDesc(border_mode=border_mode, subsample=subsample, conv_mode=conv_mode)(gpu_alloc_empty(img.shape[0], kerns.shape[1], (img.shape[2] * subsample[0]), (img.shape[3] * subsample[1])).shape, kerns.shape)
 out = gpu_alloc_empty(img.shape[0], kerns.shape[1], (img.shape[2] * subsample[0]), (img.shape[3] * subsample[1]))
 d_img = GpuDnnConvGradI()(kerns, img, out, desc)
 return d_img

def deconv ( X , w , subsample = ( 1 , 1 ) , border_mode = ( 0 , 0 ) , conv_mode = 'conv' ) : img = gpu_contiguous ( X ) kerns = gpu_contiguous ( w ) desc = GpuDnnConvDesc ( border_mode = border_mode , subsample = subsample , conv_mode = conv_mode ) ( gpu_alloc_empty ( img . shape [ 0 ] , kerns . shape [ 1 ] , ( img . shape [ 2 ] * subsample [ 0 ] ) , ( img . shape [ 3 ] * subsample [ 1 ] ) ) . shape , kerns . shape ) out = gpu_alloc_empty ( img . shape [ 0 ] , kerns . shape [ 1 ] , ( img . shape [ 2 ] * subsample [ 0 ] ) , ( img . shape [ 3 ] * subsample [ 1 ] ) ) d_img = GpuDnnConvGradI ( ) ( kerns , img , out , desc ) return d_img
sets up dummy convolutional forward pass and uses its grad as deconv currently only tested/working with same padding .