Replace BN layers in model


I am using two models, DenseNet and EfficientNet (B7) and would like to replace batch norm with group norm ( or weight standardization (

I have found several implementations of these norm techniques, however, I could not find how to edit the model (both of them are from libraries and I cannot edit the source code directly). Is there some way, how to replace all BN layers by GN od WS in PyTorch?

Best regards