Fully-Connected DNN: Compute the numbers of free parameter in a DNN
Weights at first layer will depend on the Dimension of the input too.
Let's assume, This is your Network. Input has 5 Features

$\hspace{6cm}$ Image credit - ML Visuals by dair.ai
Per layer weights and biases
\begin{array} {|r|r|}
\hline
 &amp;Weights &amp;Biases\\
\hline
Layer-1 &amp;5*3 = 15 &amp;3\\
\hline
Layer-2 &amp;3*3 = 9 &amp;3\\
\hline
Layer-3 &amp;3*4 = 12 &amp;4\\
\hline
Layer-4 &amp;4*2 = 8 &amp;2\\
\hline
\end{array}
Check with Code
import tensorflow as tf
from tensorflow import keras
model = keras.Sequential()

model.add(keras.layers.Dense( 3, activation=&quot;linear&quot;,input_shape=(5,)))
model.add(keras.layers.Dense( 3, activation=&quot;linear&quot;))
model.add(keras.layers.Dense( 4, activation=&quot;linear&quot;))
model.add(keras.layers.Dense( 2, activation=&quot;linear&quot;))

model.summary()
#model.get_weights() #Can check weights matrix with this

Output