How to set weights in Keras with a numpy array?

What is keras_layer in your code?

You can set weights these ways:

model.layers[i].set_weights(listOfNumpyArrays)    
model.get_layer(layerName).set_weights(...)
model.set_weights(listOfNumpyArrays)

Where model is an instance of an existing model.
You can see the expected length of the list and its array shapes using the method get_weights() from the same instances above.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)