Understanding neural nets’ output shape and number of parameters layer by layer: Sequential class version

Jupyter notebook is available on gist:

https://gist.github.com/marypwchin/f7fa3e570b62ed863d0c76f443ad45

In this notebook we look at 3 ways of finding the output shape and number of parameters layer by layer:

  1. Keras’ built-in method: model.summary();
  2. our home-made method: mysummary(model);
  3. manual back-of-the-envelope calculation.

We beginning by defining our home-made method, mysummary(model).
Worked examples of different network architectures, of fully connected and 2D convolution layers, will follow later.

This notebook is the sequential class version, which matches cell-by-cell with the companion function API version. Sequential class and functional API are two different ways of defining a neural network architecture in Keras.