# Number of parameters in Keras/Tensorflow Dense layers

I am a bit confused about how the number of parameters are calculated in Dense model for the Kera/Tensorflow.

For example, in the figure below I thought that both the statements were the same, but I found a different number of parameters for both. In particular, I am talking about model.add(Dense(...)) command.

• Rather than writing "Confusion in the...", could you please just put your specific question in the title? – nbro Apr 13 at 10:54

Check the documentation for Dense layer:
That is what happening in your first case - for input dimensions (4,1) you've got d0=4 and d1=1. So it creates a kernel of shape (1,32) that gets applied along the axis of dimension 4. That's why your output shape is (4,32) and you've got 32 weights + 32 biases = 64 parameters.