目录
版本问题
ImportError: cannot import name 'set_random_seed' from 'tensorflow'
module ‘tensorflow’ has no attribute ‘ConfigProto’/'Session’
`set_session` is not available when using TensorFlow 2.0
OP_REQUIRES failed at save_restore_v2_ops.cc:109 : Not found: Failed to create a NewWriteableFile:
版本问题
很多报错都是因为版本问题,TensorFlow的版本、CUDA的版本等等。比如以下的例子:
ImportError: Could not find 'cudart64_100.dll'
需要下载对应CUDA版本。
或者去网上下载cudart64_100.dll,拷贝到
C:Program FilesNVIDIA GPU Computing ToolkitCUDA10.1Developmentbin目录下
ImportError: cannot import name 'set_random_seed' from 'tensorflow'
TensorFlow-GPU2.0中遇到这个问题
2.0中的新写法:
import tensorflow tensorflow.random.set_seed(x)
module ‘tensorflow’ has no attribute ‘ConfigProto’/'Session’
tensorflow2.0版本与之前版本有所更新,故将上述代码改成之下即可:
#原版 config = tf.ConfigProto(allow_soft_placement=True)
config = tf.compat.v1.ConfigProto(allow_soft_placement=True)
#原版 sess = tf.Session(config=config)
sess =tf.compat.v1.Session(config=config) #注意 ,这里为tensorflow2.0版本,与第1.0有差距。
`set_session` is not available when using TensorFlow 2.0
若是遇到如题错误,则将
keras.backend.tensorflow_backend.set_session(tf.compat.v1.Session(config=config))
改为
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=config))
OP_REQUIRES failed at save_restore_v2_ops.cc:109 : Not found: Failed to create a NewWriteableFile:
路径写法问题,错误写法
root_path = "../results/"
正确写法
root_path = "..\results\"



