I will show it by image, look the below image of network Alexnet
The layer 256 * 13 *13
will do max pooling
operator then it will be 256 * 6 * 6
=9216. Then will be flatten to connected to 4096 Fully connect network, so the parameters will be 9216 * 4096. You can see all the parameters computed in the below excel.
cited:
https://www.learnopencv.com/understanding-alexnet/
https://medium.com/@smallfishbigsea/a-walk-through-of-alexnet-6cbd137a5637