How can I have the same initialization for all my networks?

I want to have the same weights for layer initializations in all my networks, so that when I'm comparing their first epoch loss they all start from the same value. Is there a way in keras to do this?

I have set the random seed for the numpy and tensorflow, but still I get different results in initializations.

• Have a look at this keras.io/initializers – Ankit Seth Aug 19 '19 at 6:04
• @Ankit Seth yes i have set the seed for my initializer as well – Moeinh77 Aug 19 '19 at 6:47
• hi - answered a similar question a little while back, it's a little trickier than you might think! datascience.stackexchange.com/a/37418/32697 – redhqs Aug 19 '19 at 10:43
• @redhqs hi,i followed your instructions but i couldn't get it to work – Moeinh77 Aug 20 '19 at 13:08
• @redhqs no errors,the only problem is the cost function value of first epoch is different in each run – Moeinh77 Aug 24 '19 at 5:27

from keras.initializers import RandomUniform