def perform(self, node, inp, out):
    (x,) = inp
    (z,) = out
    if self.inverse:
        if (len(x.shape) != ((self.n_dims_before + len(self.dims_neighbourhoods)) + 1)):
            raise ValueError("Images passed as input don't match the dimensions passed when this (inversed) Apply node was created")
        prod = 1
        for dim in self.dims_neighbourhoods:
            prod *= dim
        if (x.shape[(- 1)] != prod):
            raise ValueError(('Last dimension of neighbourhoods (%s) is not the product of the neighbourhoods dimensions (%s)' % (str(x.shape[(- 1)]), str(prod))))
    elif (len(x.shape) != (self.n_dims_before + len(self.dims_neighbourhoods))):
        raise ValueError("Images passed as input don't match the dimensions passed when this Apply node was created")
    if self.inverse:
        (input_shape, num_strides) = self.in_shape(x.shape)
        (out_shape, dummy) = self.out_shape(input_shape)
    else:
        input_shape = x.shape
        (out_shape, num_strides) = self.out_shape(input_shape)
    if (z[0] is None):
        if self.inverse:
            z[0] = numpy.zeros(input_shape)
        else:
            z[0] = numpy.zeros(out_shape)
        z[0] = theano._asarray(z[0], dtype=x.dtype)
    exec(self.code)
def perform(self, node, inp, out):
    (x,) = inp
    (z,) = out
    if self.inverse:
        if (len(x.shape) != ((self.n_dims_before + len(self.dims_neighbourhoods)) + 1)):
            raise ValueError("Images passed as input don't match the dimensions passed when this (inversed) Apply node was created")
        prod = 1
        for dim in self.dims_neighbourhoods:
            prod *= dim
        if (x.shape[(- 1)] != prod):
            raise ValueError(('Last dimension of neighbourhoods (%s) is not the product of the neighbourhoods dimensions (%s)' % (str(x.shape[(- 1)]), str(prod))))
    elif (len(x.shape) != (self.n_dims_before + len(self.dims_neighbourhoods))):
        raise ValueError("Images passed as input don't match the dimensions passed when this Apply node was created")
    if self.inverse:
        (input_shape, num_strides) = self.in_shape(x.shape)
        (out_shape, dummy) = self.out_shape(input_shape)
    else:
        input_shape = x.shape
        (out_shape, num_strides) = self.out_shape(input_shape)
    if (z[0] is None):
        if self.inverse:
            z[0] = numpy.zeros(input_shape)
        else:
            z[0] = numpy.zeros(out_shape)
        z[0] = theano._asarray(z[0], dtype=x.dtype)
    exec(self.code)