What seeds must be installed in order to realize 100% reproducibility of learning outcomes in tensor flow?

In the general setup of tensor flow, as

model = construct_model()
with tf.Session() as sess:
    train_model(sess)

Where it construct_model()contains the definition of the model, including random initialization of weights ( tf.truncated_normal), and train_model(sess)performs model training -

What seeds need to be specified, where to ensure 100% reproducibility between repeated starts of the above code fragment? The documentation for tf.random.set_random_seedmay be brief, but a little confusing to me. I did my best:

tf.set_random_seed(1234)
model = construct_model()
    with tf.Session() as sess:
        train_model(sess)

But each time received different results.

+7
source share
2 answers

, numpy.random. , , numpy.

+1

, , - :

pip install tensorflow-determinism

import tensorflow as tf
import os
os.environ['TF_DETERMINISTIC_OPS'] = '1'

: https://github.com/NVIDIA/tensorflow-determinism

0

Source: https://habr.com/ru/post/1668725/


All Articles