'Sets the weights of the model.
# Arguments
weights: A list of Numpy arrays with shapes and types matching
the output of `model.get_weights()`.'

def set_weights(self, weights):

    tuples = []
    for layer in self.layers:
        num_param = len(layer.weights)
        layer_weights = weights[:num_param]
        for (sw, w) in zip(layer.weights, layer_weights):
            tuples.append((sw, w))
        weights = weights[num_param:]
    K.batch_set_value(tuples)
