![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/369175/image.png)
fully connected layer in a CNN
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jyoti Nautiyal
le 27 Sep 2020
Commenté : Jyoti Nautiyal
le 2 Oct 2020
I trained a CNN for MNIST dataset with one fully connected layer. The input to fully connected layer is 9 channels of size 20 x 20, and ouput is 10 classes. How can i calculate the total number of multiplications and additions in this layer.
0 commentaires
Réponse acceptée
Srivardhan Gadila
le 1 Oct 2020
You can use the analyzeNetwork to view the network architecture, shape of layerwise Activations & Learnables etc.
Based on the above information and under the assumption that your fullyConnectedLayer is having bias as Learnables then the layer has an input vector of size 4000 (i.e., 20x20x10 flattened) and the size of Weights & Bias are 10x4000, 10x1 respectively.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/369175/image.png)
The general operation of fullyConnectedLayer is Z = W*X + b => 10*4000 = 40,000 multiplications and 39,990 + 10 = 40,000 additions.
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!