Created
October 19, 2021 10:18
-
-
Save ahmedbesbes/b767f9b7592715d716df85b3d47b8a6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def seed_everything(seed=1234): | |
random.seed(seed) | |
os.environ['PYTHONHASHSEED'] = str(seed) | |
np.random.seed(seed) | |
tensorflow.random.set_seed(seed) | |
tensorflow.keras.layers.Dropout(x, seed=SEED) | |
tensorflow.image.random_flip_left_right(x, seed=seed) | |
tensorflow.random_normal_initializer(x, y, seed=seed) | |
# call this function a the beginning of your script | |
seed_everything() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment