I'm trying to set seed using tf.random.set_seed
instead of tf.set_random_seed
, but still getting the error as module 'tensorflow' has no attribute 'set_random_seed'
Trying to run this:
def __init__(self, log_name, heatmap_size, image_size, loss_type = 'SCE', is_training = True):
tf.random.set_seed(0)
But getting the error:
28
29
def __init__(self, log_name, heatmap_size, image_size, loss_type = 'SCE', is_training = True):
---> 30 tf.random.set_seed(0)
31
32 if loss_type not in { 'MSE', 'SCE' }:
AttributeError: module 'tensorflow' has no attribute 'set_random_seed'
For Tensorflow 2.15 you can use:
tf.keras.utils.set_random_seed(
seed
)
Link to document : https://www.tensorflow.org/api_docs/python/tf/keras/utils/set_random_seed