

def __init__(self, nchan_in, nchan_out, filter_size, stride=1, border=0, mode='cross', init=df.init.xavier(), bias=df.init.const(0)):
    df.Module.__init__(self)
    self.nchan_in = nchan_in
    self.nchan_out = nchan_out
    self.filter_size = filter_size
    self.mode = mode
    self.stride = expand(stride, len(filter_size), 'stride')
    self.border = expand(border, len(filter_size), 'border')
    if (self.border == 'same'):
        assert all((((k % 2) == 1) for k in self.filter_size)), "'same' convolution only supports odd filter sizes."
        self.border = tuple((((k - 1) // 2) for k in self.filter_size))
    w_shape = ((nchan_in, nchan_out) + self.filter_size)
    w_fan = ((np.prod(self.filter_size) * nchan_out), (np.prod(self.filter_size) * nchan_in))
    w_name = ('Wconv_{},{}@{}' + ('x{}' * (len(w_shape) - 3))).format(*w_shape)
    self.W = self._addparam(w_shape, init, fan=w_fan, name=w_name)
    if (bias not in (None, False)):
        self.b = self._addparam(nchan_out, bias, decay=False, name='bconv_{}'.format(nchan_out))
    else:
        self.b = None

dataset/ETHPy150Open lucasb-eyer/DeepFried2/DeepFried2/layers/BackwardsConvolutionCUDNN.py BackwardsConvolutionCUDNN.__init__/original