Understanding a Neural Network with Keras (preferably), TensorFlow or PyTorch
From Keras Issue #41:


  One simple way to do it, is to use the weights of your model to build a new model that's truncated at the layer you want to read. Then you can run the ._predict(X_batch) method to get the activations for a batch of inputs.