title: How to check the number of layers in a neural network in python and when should we increase the layers?
body: <p>Please add a minimum comment on your thought, so that I can improve my query. Thanks. -)</p>
  <hr />
  <p>I am working on the <code>MNIST</code> dataset and write some <code>CNN</code> code. However, I am confused about some of the points with the <code>CNN</code> code. How to know the number of layers in a neural network? With my current understanding, I think this has 6 layers with 4 hidden layers. Is that right? and what if I need to extend to 10 layers? how to do it?</p>
  <pre><code>from tensorflow.keras.models import Sequential
  from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, MaxPooling2D
  
  model = Sequential()
  model.add(Conv2D(28, kernel_size=(3,3), 
                      input_shape = ...))
  model.add(MaxPooling2D(pool_size=(2,2)))
  model.add(Flatten())
  model.add(Dense(128, activation=tf.nn.relu))
  model.add(Dropout(0.2))
  model.add(Dense(10, activation=tf.nn.softmax))
  </code></pre>