Pruning in Keras

Take a look at Keras Surgeon: https://github.com/BenWhetton/keras-surgeon

I have not tried it myself, but the documentation claims that it has functions to remove or insert nodes.

Also, after looking at some papers on pruning, it seems that many researchers create a new model with less channels (or less layers), and then copy the weights from the original model to the new model.


See this dedicated tooling for tf.keras. https://www.tensorflow.org/model_optimization/guide/pruning

As the overview suggests, support for latency improvements is a work in progress

Edit: Keras -> tf.keras based on LucG's suggestion.


Not a dedicated way :(

There's currently no easy (dedicated) way of doing this with Keras.

A discussion is ongoing at https://groups.google.com/forum/#!topic/keras-users/oEecCWayJrM.

You may also be interested in this paper: https://arxiv.org/pdf/1608.04493v1.pdf.