ok. I understand the confusion. Maybe I contributed to it too.
Basically weight[i] is the way to get the parameters of the neuron. But the number of neuron calculations is different between the linear layer and conv layer.
Linear layer:
With respect to linear layers, it is clear how many neurons are present in the layer. (layer.weight.shape[0])
Conv layer:
With conv layers, the number of neurons calculation is a bit tricky which is explained in that StackOverflow post. I will rephrase it here as I understand.
In 2D conv layers, a neuron is an entity that looks at only a small slice of the input. Lets take the same example from StackOverflow  where input size = 1x27x27 (channels=1, height=27, width=27), slice size = 1x3x3. So there are 9x9=81 slices of size 1x3x3 assuming non-overlapping slices.
Since conv layer holds the invariance property, a set of 81 neurons is supposed to share the same weights (i.e., layer.weight[i]). There can be N sets of 81 neurons in a conv layer (N = layer.weight.shape[0]). So the total number of neurons is N x 81.
Hope this makes sense.