# Path: scripts/keras/keras/layers/core.py
# class Layer(object):
#     def __init__(self):
#         self.params = []
# 
#     def connect(self, node):
#         self.previous = node
# 
#     def get_output(self, train):
#         raise NotImplementedError
# 
#     def get_input(self, train):
#         if hasattr(self, 'previous'):
#             return self.previous.get_output(train=train)
#         else:
#             return self.input
# 
#     def set_weights(self, weights):
#         for p, w in zip(self.params, weights):
#             p.set_value(floatX(w))
# 
#     def get_weights(self):
#         weights = []
#         for p in self.params:
#             weights.append(p.get_value())
#         return weights
# 
#     def get_config(self):
#         return {"name":self.__class__.__name__}


import theano
import theano.tensor as T
from theano.tensor.signal import downsample
from .. import activations, initializations
from ..utils.theano_utils import shared_zeros
from ..layers.core import Layer
        self.W_shape = (nb_filter, stack_size, nb_row, nb_col)
        self.W = self.init(self.W_shape)
        self.b = shared_zeros((nb_filter,))

        self.params = [self.W, self.b]

        if weights is not None:
            self.set_weights(weights)

    def get_output(self, train):
        X = self.get_input(train)

        conv_out = theano.tensor.nnet.conv.conv2d(X, self.W, 
            border_mode=self.border_mode, subsample=self.subsample, image_shape=self.image_shape)
        output = self.activation(conv_out + self.b.dimshuffle('x', 0, 'x', 'x'))
        return output

    def get_config(self):
        return {"name":self.__class__.__name__,
            "nb_filter":self.nb_filter,
            "stack_size":self.stack_size,
            "nb_row":self.nb_row,
            "nb_col":self.nb_col,
            "init":self.init.__name__,
            "activation":self.activation.__name__,
            "image_shape":self.image_shape,
            "border_mode":self.border_mode,
            "subsample":self.subsample}



# Path: scripts/keras/keras/layers/core.py
# class Layer(object):
#     def __init__(self):
#         self.params = []
# 
#     def connect(self, node):
#         self.previous = node
# 
#     def get_output(self, train):
#         raise NotImplementedError
# 
#     def get_input(self, train):
#         if hasattr(self, 'previous'):
#             return self.previous.get_output(train=train)
#         else:
#             return self.input
# 
#     def set_weights(self, weights):
#         for p, w in zip(self.params, weights):
#             p.set_value(floatX(w))
# 
#     def get_weights(self):
#         weights = []
#         for p in self.params:
#             weights.append(p.get_value())
#         return weights
# 
#     def get_config(self):
#         return {"name":self.__class__.__name__}


# Path: scripts/keras/keras/layers/convolutional.py
import theano
import theano.tensor as T
from theano.tensor.signal import downsample
from .. import activations, initializations
from ..utils.theano_utils import shared_zeros
from ..layers.core import Layer

        self.W_shape = (nb_filter, stack_size, nb_row, nb_col)
        self.W = self.init(self.W_shape)
        self.b = shared_zeros((nb_filter,))

        self.params = [self.W, self.b]

        if weights is not None:
            self.set_weights(weights)

    def get_output(self, train):
        X = self.get_input(train)

        conv_out = theano.tensor.nnet.conv.conv2d(X, self.W, 
            border_mode=self.border_mode, subsample=self.subsample, image_shape=self.image_shape)
        output = self.activation(conv_out + self.b.dimshuffle('x', 0, 'x', 'x'))
        return output

    def get_config(self):
        return {"name":self.__class__.__name__,
            "nb_filter":self.nb_filter,
            "stack_size":self.stack_size,
            "nb_row":self.nb_row,
            "nb_col":self.nb_col,
            "init":self.init.__name__,
            "activation":self.activation.__name__,
            "image_shape":self.image_shape,
            "border_mode":self.border_mode,
            "subsample":self.subsample}



class MaxPooling2D(Layer):