trying to understand effect of Second Layer on the result of first layer…
First layer will output predictions, now these predictions are feed as input to second layer
nn.Linear(28*28,30) receives a data sample (i.e., a handwritten digit) and linearly transforms it to obtain a vector of dimension 30 (30 is an arbitrary figure, and there are myriad other choices, e.g., 90, 60, 20, or 10. However, it is best to experiment and discover which delivers the best accuracy). Next, its result is run through a non-linear layer, i.e., ReLU. Finally, the output of ReLU is passed to nn.Linear(30,1), which yields the score of the input being a 3, with a higher value meaning the model is more confident it was a 3.
Sorry, I don’t quite understand your statement - are you asking whether the purpose of the second linear layer is to make predictions given the output of the ReLU, in which case you would be correct (although the story is more nuanced and requires further elaboration), or am I misinterpreting your meaning?
Yes, you understand me correctly and that’s what I am asking.
Let me elaborate this more.
Output of first layer is vector of dimension(30), goes through nn.ReLU() layer, After going through nn.ReLU(), it [vector of dimension (30)] goes through second layer which is matrix (30,1). So I am interpreting that
That is what I think is happening…
may be I am wrong or missing something here. if so, kindly point me in right direction