tf.keras.utils.set_random_seed

Sets all random seeds for the program (Python, NumPy, and TensorFlow).

Used in the notebooks

Used in the guide Used in the tutorials

You can use this utility to make almost any Keras program fully deterministic. Some limitations apply in cases where network communications are involved (e.g. parameter server distribution), which creates additional sources of randomness, or when certain non-deterministic cuDNN ops are involved.

Calling this utility is equivalent to the following:

import random
import numpy as np
import tensorflow as tf
random.seed(seed)
np.random.seed(seed)
tf.random.set_seed(seed)

seed Integer, the random seed to use.