Where are those numbers coming from in pytorch neural networks?
I'm newbie in Pytorch (python), i was just scrolling through their official tutorial and i found this simple neural network architecture. Everything is clear, but those numbers, last three fully connected layers, where are they coming from?
self.fc1 = nn.Linear(16 * 6 * 6, 120)  # 6*6 from image dimension and 16 from last conv layer
self.fc2 = nn.Linear(120, 84) # but here, 120? 84? why? is this just random or there is some logic behind it?
self.fc3 = nn.Linear(84, 10) 

full code - https://pytorch.org/tutorials/beginner/blitz/neural_networks_tutorial.html#sphx-glr-beginner-blitz-neural-networks-tutorial-py


self.fc1 = nn.Linear(16 * 6 * 6, 120)
self.fc2 = nn.Linear(120, 84) # you can use any number instead of 120 play with this number and see which gives you best result.
self.fc3 = nn.Linear(84, 10) 

120 is number of units in first layer after conv layer , 84 in second layer and 10 in last which probably is dimension of your output layer ie. 10 possible type of classification.
You are correct the dimension of second and third layer is not fixed and you can try different value of num of units and choose one which gives you the best result. You can play with it but you can also look at some of the best performing models and follow the structure they use.
