Set bias in CNN
<p>I have two massive numpy arrays of weights and biases for a CNN. I can set weights for each layer (using <code>set_weights</code>) but I don't see a way to set the bias for each layer. How do I do this?</p>

<p>You do this by using <code>layer.set_weights(weights)</code>. From the documentation:</p>

<blockquote>
<pre><code>weights: a list of Numpy arrays. The number
         of arrays and their shape must match
         number of the dimensions of the weights
         of the layer (i.e. it should match the
         output of `get_weights`).
</code></pre>
</blockquote>

<p>You don't just put the weights for the filter in there but for <em>each</em> parameter the layer has. The order in which you have to put in the weights depends on <code>layer.weights</code>. You may look at the code or print the names of the weights of the layer by doing something like</p>

<pre><code> print([p.name for p in layer.weights])
</code></pre>

python deep-learning keras