解决module ‘tensorflow’ has no attribute ‘app’?
由于我使用的tensotflow2.版本,所以运行为1.版本的代码时报错,
用tf.compat.v1.flags替换tf.app.flags 即可,然后就解决了,避免了重新安装1.版本
下面还有一些版本问题:
tf.set_random_seed(seed)
tf.random.set_seed(seed)
当遇到类似的问题,或者可以用下面解决:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()