How do I get reproducible results with Tensorflow 2.0?

时光总嘲笑我的痴心妄想 提交于 2021-01-29 10:23:12

问题


I have seen this FAQ and this stackoverflow about reproducibility in keras and TF 1.x. How do I do something similar in TF 2.0 because it no longer has tf.Session? I know I could still set the graph seed and the seed for each initialization in the layer by passing something like tf.keras.initializers.GlorotNormal(seed=10). However, I am wondering if there is something more convenient.


回答1:


Consider using tf.random.set_seed(seed) at the startup. In my use cases it provides reproducible results.



来源:https://stackoverflow.com/questions/60127576/how-do-i-get-reproducible-results-with-tensorflow-2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!