I have a CNN with batchnorm layers. I am trying to train the CNN for a few epochs, and then I want to reset the batchnorm weights (moving_mean and moving_variance) while preserving the learned CNN weights.
Is there a way of doing this?
I thought of using build_from_config (reference), but in Keras, batchnorm doesn't store its input shape in the configuration dictionary (you can see the code here).
I think I found a way to do this, but it's probably a bit unorthodox since it uses Keras private variables from base_layer.py.
I'll leave the question open in case a better (more "Pythonic") solution exists.