'Input is assumed to be of shape batch*height*width*channels'

def __init__(self, incoming, num_filters, filter_size, stride=1, pad='VALID', untie_biases=False, W=XavierUniformInitializer(), b=tf.zeros_initializer(), nonlinearity=tf.nn.relu, n=None, **kwargs):

    super(BaseConvLayer, self).__init__(incoming, **kwargs)
    if (nonlinearity is None):
        self.nonlinearity = tf.identity
    else:
        self.nonlinearity = nonlinearity
    if (n is None):
        n = (len(self.input_shape) - 2)
    elif (n != (len(self.input_shape) - 2)):
        raise ValueError(('Tried    to    create    a    %dD    convolution    layer    with    input    shape    %r.    Expected    %d    input    dimensions    (batchsize,    channels,    %d    spatial    dimensions).' % (n, self.input_shape, (n + 2), n)))
    self.n = n
    self.num_filters = num_filters
    self.filter_size = as_tuple(filter_size, n, int)
    self.stride = as_tuple(stride, n, int)
    self.untie_biases = untie_biases
    self.pad = pad
    if (pad == 'SAME'):
        if any((((s % 2) == 0) for s in self.filter_size)):
            raise NotImplementedError('`same`    padding    requires    odd    filter    size.')
    self.W = self.add_param(W, self.get_W_shape(), name='W')
    if (b is None):
        self.b = None
    else:
        if self.untie_biases:
            biases_shape = (self.output_shape[1:3] + (num_filters,))
        else:
            biases_shape = (num_filters,)
        self.b = self.add_param(b, biases_shape, name='b', regularizable=False)
