def set_weights(self, weights):
        params = self.weights
        if len(params) != len(weights):
            raise Exception('Provided weight array does not match  weights (' +
                            str(len(params)) + ' optimizer params vs. ' +
                            str(len(weights)) + ' provided weights)')
        for p, w in zip(params, weights):
            if K.get_value(p).shape != w.shape:
                raise Exception('Optimizer weight shape ' +
                                str(K.get_value(p).shape) +
                                ' not compatible with '
                                'provided weight shape ' + str(w.shape))
            K.set_value(p, w)
Sets the weights of the optimizer, from Numpy arrays.
dataset/ETHPy150Open fchollet/keras/keras/optimizers.py/Optimizer.set_weights