Merge Batch Normarlization to fc or conv layer based on PaddlePaddle

When the training process is finished, we can merge the batch normalization with the convolution or fully connected layer. Doing so will give us a forward acceleration.

For more details about batch normalization,see here


We demonstrate a demo of Mobilenet.

Preparation for Merge

  1. the source model config with batch normalization. see ./demo/
  2. the source model with batch normalization. see ./demo/models/mobilenet_flowers102.tar.gz
  3. the dest model config without batch normalization see ./demo/

Merge Batch norm

  1. modify the SOURCE_MODEL_NAME and DEST_MODEL_NAME in
  2. Run sh

Verify Correctness

  1. Separate modify the source and dest model in ./demo/ and Run python ./demo/


  1. Merge batch normalization speeds up the forward process by around 30%.