Created
April 13, 2018 18:27
-
-
Save elijahc/eabbe365b3b2ba468d33be97e788fec8 to your computer and use it in GitHub Desktop.
Reset weights in a Keras layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import keras.backend as K | |
| def reset_weights(model): | |
| session = K.get_session() | |
| for layer in model.layers: | |
| if hasattr(layer, 'kernel_initializer'): | |
| layer.kernel.initializer.run(session=session) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment