THIS IS ELLIE

AttributeError: module 'tensorflow' has no attribute 'set_random_seed' 본문

낑낑/Troubleshooting

AttributeError: module 'tensorflow' has no attribute 'set_random_seed'

Ellie Kim 2020. 4. 16. 14:00
seed = 0
numpy.random.seed(seed)
tf.set_random_seed(seed)

seed값을 생성해 주는데 AttributeError: module 'tensorflow' has no attribute 'set_random_seed' 에러가 발생했다.

문서를 확인해보니 변경되었다.

tf.set_random_seed(seed)

대신 아래와 동일하게 사용해주면 된다.

tf.random.set_seed(seed)

 

https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/random/set_seed

 

tf.random.set_seed  |  TensorFlow Core r2.0

Sets the graph-level random seed. Aliases: tf.compat.v2.random.set_seed tf.random.set_seed(seed) Used in the tutorials: Operations that rely on a random seed actually derive it from two seeds: the graph-level and operation-level seeds. This sets the graph-

www.tensorflow.org

 

반응형