How to set weights of the batch normalization layer?

343 views
Skip to first unread message

proni...@gmail.com

unread,
Mar 14, 2017, 2:25:02 PM3/14/17
to Keras-users
Hi all,

How do I set weights of the batch normalization layer?

I am bit confused by the documentation 

  • weights: Initialization weights. List of 2 Numpy arrays, with shapes: [(input_shape,), (input_shape,)] Note that the order of this list is [gamma, beta, mean, std]

Do we need all four [gamma, beta, mean, std]? Is there a way to set weights using only [gamma, beta].


Thanks for the help.

François Chollet

unread,
Mar 14, 2017, 2:33:41 PM3/14/17
to proni...@gmail.com, Keras-users
The docs need to be clarified. You do need all 4 arrays in a call to `set_weights`.
Otherwise you can call `K.set_value` on specific attributes of the layer (e.g. `layer.gamma`).

proni...@gmail.com

unread,
Mar 14, 2017, 2:40:17 PM3/14/17
to Keras-users, proni...@gmail.com
Thanks Francois! I will try that.
Reply all
Reply to author
Forward
0 new messages