

def symb_forward(self, symb_input):
    ' creates dummy forward conv and uses its gradient as backwards pass '
    ' This code is mostly taken from https://github.com/Newmu/dcgan_code/blob/master/lib/ops.py '
    img = gpu_contiguous(symb_input)
    kerns = gpu_contiguous(self.W.param)
    alloc_shape = ((img.shape[0], kerns.shape[1]) + tuple(((i * d) for (i, d) in zip(img.shape[2:], self.stride))))
    desc = dnn.GpuDnnConvDesc(border_mode=self.border, subsample=self.stride, conv_mode=self.mode)(gpu_alloc_empty(*alloc_shape).shape, kerns.shape)
    out = gpu_alloc_empty(*alloc_shape)
    grad = (dnn.GpuDnnConv3dGradI if (symb_input.ndim == 5) else dnn.GpuDnnConvGradI)
    conv_output = grad()(self, img, out, desc)
    if (self.b is not None):
        d_shuffle = (('x', 0) + (tuple('x') * (symb_input.ndim - 2)))
        conv_output += self.b.param.dimshuffle(*d_shuffle)
    return conv_output

dataset/ETHPy150Open lucasb-eyer/DeepFried2/DeepFried2/layers/BackwardsConvolutionCUDNN.py BackwardsConvolutionCUDNN.symb_forward/VarMisuse@158/279 `kerns`->`self`