(self, in_x, in_x_channels, imsize, batchsize=128,
                 filter_sizes=[[50, 3, 3], [100, 3, 3]], poolings=[2, 2])
Allocate a CNN network with shared variable internal parameters.

        :type in_x: theano.tensor.dtensor4
        :param in_x: symbolic input image tensor, of shape [batchsize, in_x_channels, imsize[0], imsize[1]]
        Typically : first channel is image, second is the reward prior, third is the current state image.

        :type in_x_channels: int32
        :param in_x_channels: number of input channels

        :type imsize: tuple or list of length 2
        :param imsize: (image height, image width)

        :type batchsize: int32
        :param batchsize: batch size

        :type filter_sizes: int32 list of int32 3-tuples
        :param filter_sizes: list of filter sizes for each layer, each a list of 3 integers:
        num_filters,filter_width,filter_height

        :type batchsize: int32 list
        :param batchsize: list of pooling ratios after each layer (assumed symmetric)
Allocate a CNN network with shared variable internal parameters.
Allocate a CNN network with shared variable internal parameters .
def __init__(self, in_x, in_x_channels, imsize, batchsize=128,
                 filter_sizes=[[50, 3, 3], [100, 3, 3]], poolings=[2, 2]):
        """
        Allocate a CNN network with shared variable internal parameters.

        :type in_x: theano.tensor.dtensor4
        :param in_x: symbolic input image tensor, of shape [batchsize, in_x_channels, imsize[0], imsize[1]]
        Typically : first channel is image, second is the reward prior, third is the current state image.

        :type in_x_channels: int32
        :param in_x_channels: number of input channels

        :type imsize: tuple or list of length 2
        :param imsize: (image height, image width)

        :type batchsize: int32
        :param batchsize: batch size

        :type filter_sizes: int32 list of int32 3-tuples
        :param filter_sizes: list of filter sizes for each layer, each a list of 3 integers:
        num_filters,filter_width,filter_height

        :type batchsize: int32 list
        :param batchsize: list of pooling ratios after each layer (assumed symmetric)
        """
        assert len(filter_sizes) == len(poolings)
        n_conv_layers = len(filter_sizes)
        self.params = []
        # first conv layer
        prev_layer = ConvLayer(in_x, filter_shape=[filter_sizes[0][0], in_x_channels, filter_sizes[0][1],
                                                   filter_sizes[0][2]],
                               image_shape=[batchsize, in_x_channels, imsize[0], imsize[1]],
                               poolsize=(poolings[0], poolings[0]))
        self.params = self.params + prev_layer.params
        # then the rest of the conv layers
        for l in range(1, n_conv_layers):
            new_layer = ConvLayer(prev_layer.output,
                                  filter_shape=[filter_sizes[l][0], prev_layer.out_shape[1], filter_sizes[l][1],
                                                filter_sizes[l][2]],
                                  image_shape=prev_layer.out_shape,
                                  poolsize=(poolings[l], poolings[l]))
            self.params = self.params + new_layer.params
            prev_layer = new_layer
        # fully connected layer
        final_conv_shape = new_layer.out_shape
        flat_conv_out = new_layer.output.flatten(ndim=2)
        flat_shape = [final_conv_shape[0], final_conv_shape[1]*final_conv_shape[2]*final_conv_shape[3]]
        self.w_o = init_weights_T(flat_shape[1], 8)
        self.output = T.nnet.softmax(T.dot(flat_conv_out, self.w_o))
        self.params = self.params + [self.w_o]
def __init__ ( self , in_x , in_x_channels , imsize , batchsize = 128 , filter_sizes = [ [ 50 , 3 , 3 ] , [ 100 , 3 , 3 ] ] , poolings = [ 2 , 2 ] ) : assert len ( filter_sizes ) == len ( poolings ) n_conv_layers = len ( filter_sizes ) self . params = [ ] # first conv layer prev_layer = ConvLayer ( in_x , filter_shape = [ filter_sizes [ 0 ] [ 0 ] , in_x_channels , filter_sizes [ 0 ] [ 1 ] , filter_sizes [ 0 ] [ 2 ] ] , image_shape = [ batchsize , in_x_channels , imsize [ 0 ] , imsize [ 1 ] ] , poolsize = ( poolings [ 0 ] , poolings [ 0 ] ) ) self . params = self . params + prev_layer . params # then the rest of the conv layers for l in range ( 1 , n_conv_layers ) : new_layer = ConvLayer ( prev_layer . output , filter_shape = [ filter_sizes [ l ] [ 0 ] , prev_layer . out_shape [ 1 ] , filter_sizes [ l ] [ 1 ] , filter_sizes [ l ] [ 2 ] ] , image_shape = prev_layer . out_shape , poolsize = ( poolings [ l ] , poolings [ l ] ) ) self . params = self . params + new_layer . params prev_layer = new_layer # fully connected layer final_conv_shape = new_layer . out_shape flat_conv_out = new_layer . output . flatten ( ndim = 2 ) flat_shape = [ final_conv_shape [ 0 ] , final_conv_shape [ 1 ] * final_conv_shape [ 2 ] * final_conv_shape [ 3 ] ] self . w_o = init_weights_T ( flat_shape [ 1 ] , 8 ) self . output = T . nnet . softmax ( T . dot ( flat_conv_out , self . w_o ) ) self . params = self . params + [ self . w_o ]