Last active
March 7, 2016 18:31
-
-
Save lukedeo/c7d9632d78e1dd471718 to your computer and use it in GitHub Desktop.
Custom initializer for Keras
This file contains 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 | |
import numpy as np | |
def custom_uniform(shape, range=(-1, 1), name=None): | |
min_, max_ = range | |
return K.variable(np.random.uniform(low=min_, high=max_, size=shape), name=name) | |
net.add(Dense(10, input_dim=5, init=lambda shape, name: custom_uniform(shape, (-10, 5), name))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment