Khan
Khan

Reputation: 1518

keras convnet 1d has bias although activation=none

i have a convoutional neuronal network with keras:

 x = tf.keras.layers.Conv1D(128, 65, padding='same', strides=2,activation=None)(input)

The input has the size (8192,1)

if i check my model summary, the layer has following properties, output shape and params:

 (None, 4096, 128)    8448 

Here how to calculate the params:

Input I x I x C
Filter F x F (x K) // K times applied
Parameters (F x F x C + 1) x K // where +1 bias per filter, and K is the number of filters

i calculated the params -> (65 x 1 x 1 + 1) x 128 that gave me exact 8448. But i dont understand why the bias is inside it? I have activation=None.

here I read:

If use_bias is True, a bias vector is created and added to the outputs. Finally, if activation is not None, it is applied to the outputs as well.

I have not set bias to true and activation to none.

Upvotes: 0

Views: 384

Answers (1)

Dr. Snoopy
Dr. Snoopy

Reputation: 56367

The parameter use_bias is set to True by default, so this is the simple reason why your parameter count does not match. Activation also does not affect the use of biases.

Upvotes: 2

Related Questions