@wraps(Layer.set_input_space)
    def set_input_space(self, space):

        self.input_space = space

        if not isinstance(space, Conv2DSpace):
            raise BadInputSpaceError(self.__class__.__name__ +
                                     ".set_input_space "
                                     "expected a Conv2DSpace, got " +
                                     str(space) + " of type " +
                                     str(type(space)))

        rng = self.mlp.rng

        if self.border_mode == 'valid':
            output_shape = [int((self.input_space.shape[0]
                                 - self.kernel_shape[0])
                                / self.kernel_stride[0]) + 1,
                            int((self.input_space.shape[1]
                                 - self.kernel_shape[1])
                                / self.kernel_stride[1]) + 1]
        elif self.border_mode == 'full':
            output_shape = [int((self.input_space.shape[0]
                                 + self.kernel_shape[0])
                                / self.kernel_stride[0]) - 1,
                            int((self.input_space.shape[1]
                                 + self.kernel_shape[1])
                                / self.kernel_stride[1]) - 1]

        self.detector_space = Conv2DSpace(shape=output_shape,
                                          num_channels=self.output_channels,
                                          axes=('b', 'c', 0, 1))

        self.initialize_transformer(rng)

        W, = self.transformer.get_params()
        W.name = self.layer_name + '_W'

        if self.tied_b:
            self.b = sharedX(np.zeros((self.detector_space.num_channels)) +
                             self.init_bias)
        else:
            self.b = sharedX(self.detector_space.get_origin() + self.init_bias)

        self.b.name = self.layer_name + '_b'

        logger.info('Input shape: {0}'.format(self.input_space.shape))
        logger.info('Detector space: {0}'.format(self.detector_space.shape))

        self.initialize_output_space()
Note: this function will reset the parameters!
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/models/mlp.py/ConvElemwise.set_input_space