How to calculate the number of parameters of 1d convolutional neural networks?

你离开我真会死。 提交于 2020-06-28 08:44:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!