How to freeze BN layers while training the rest of network (mean and var wont freeze)

I have a network that consists of batch normalization (BN) layers and other layers (convolution, FC, dropout, etc) I was wondering how we can do the following : I want to freeze all the layer and just train the BN layers freeze the BN layers and train every other layer in the network except BN l…