Exemple #1
0
    def __setstate__(self, state):

        self.layers = []
        for idx, param in enumerate(state["layer_params"]):
            layer = create_layer(param)
            self.layers.append(layer)

        self.cost = create_cost(state["cost"])
Exemple #2
0
    def __init__(self, layer_params, cost_param):

        self.layers = []

        for idx, param in enumerate(layer_params):
            layer = create_layer(param)
            self.layers.append(layer)

            if idx > 0:
                assert layer.input_dim() == self.layers[idx-1].output_dim(), \
                    "The layer chain is broken at %d-th layer"%idx

        self.cost = create_cost(cost_param)

        X = theano.tensor.matrix("X")


        layer_out = X
        for layer in self.layers:
            layer_out = layer.output(layer_out)

        self.__predict_func = theano.function([X],
                                              outputs=layer_out)