title: How do CNN layers add their bias values?
body: <p>I need to write my CNN model as a Theano function with my weights already set by Keras (Tensorflow as the backend), but I am unsure about how to add the bias values associated with each layer.</p>
  
  <p>This solution <a href="https://stackoverflow.com/questions/30247061/how-can-i-get-a-1d-convolution-in-theano/32147403#32147403">How can I get a 1D convolution in theano</a> works nicely to write a single layer as a Theano function, but I need to stack my weights with the biases from each layer</p>
  
  <p>Simplified version of my code:</p>
  
  <pre><code>model = Sequential([
  
      InputLayer(batch_input_shape=(None,100,1)),
      Convolution1D(nb_filter=16, filter_length=8, activation='relu', border_mode='same', init='he_normal', input_shape=(None,100,1)),
      Convolution1D(nb_filter=32, filter_length=8, activation='relu', border_mode='same', init='he_normal'), 
      MaxPooling1D(pool_length=4),
      Flatten(),
      Dense(output_dim=32, activation='relu', init='he_normal'),
      Dense(output_dim=1, input_dim=32, activation='linear'),
  ])
  </code></pre>
  
  <p>How do you add the bias weights to the CNN layer?</p>
  
  <p>For instance, the weights of my first layer have the  dimensions: (8, 1, 1, 16)</p>
  
  <p>With a bias with dimensions: (16,)</p>
  
  <p>Which is easy enough to concatenate together to get dimensions: (9, 1, 1, 16)</p>
  
  <p>but for the next layer I have dimensions: (8, 1, 16, 32)</p>
  
  <p>with a bias with dimensions: (32,)</p>
  
  <p>How can I combine this into one weight matrix? To put into the Theano T.signal.conv.conv2d function?</p>