reinitialize parameters in keras
# Reset/Reinitialize model weights/parameters · Issue #341 · keras-team/keras
# https://github.com/keras-team/keras/issues/341
session = K.get_session()
for layer in model.layers:
for v in layer.__dict__:
v_arg = getattr(layer,v)
if hasattr(v_arg,'initializer'):
initializer_method = getattr(v_arg, 'initializer')
initializer_method.run(session=session)
print(f'reinitializing layer {layer.name}.{v}')