问题
I am referring to the implementation of "Text classification using CNN" on this link https://richliao.github.io/supervised/classification/2016/11/26/textclassifier-convolutional. Here in section "A simplified Convolutional", they have used the following layer of keras:
Conv1D(128, 5, activation='relu')
As per my understanding, no of parameters should be 5*100*128=64,000. But the model summary is showing 64,128 parameters.
Could someone help me to understand where am i wrong in my calculation?
回答1:
The window size is 5 and the number of channels in the input is 100. Hence, the input size is 5*100. There are 128 filters to which you need to connect the whole input. Therefore, there are 5*100*128 different edge weights to learn. In addition, the bias vector is of size 128 as there are 128 filters. So, the total number of parameters to be learned for this layer is 5*100*128+128.
来源:https://stackoverflow.com/questions/49211957/how-to-calculate-the-number-of-parameters-of-1d-convolutional-neural-networks