4

I'd like to set seed value of glorot_uniform kernel initializer in Keras.

model.add(Dense(50, input_dim=self.state_size, activation='relu', kernel_initializer='glorot_uniform(seed=0)'))

When I use above code, error message is below.

ValueError: Unknown initializer: glorot_uniform(seed=0)

If I remove "(seed=0)" like as below

 model.add(Dense(50, input_dim=self.state_size, activation='relu', kernel_initializer='glorot_uniform'))

It works well without setting a seed value.

How can I set a seed value?

1 Answer 1

8

Keras can use strings and functions as arguments for initilizers. The strings just use the default options for initializers. Try this line of code for your FC layer:

from keras import initializers
model.add(Dense(50, input_dim=self.state_size, activation='relu', kernel_initializer=initializers.glorot_uniform(seed=0)))

Here you have the documentation for the initializers: https://keras.io/initializers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.