当前位置:网站首页>Various errors encountered by tensorflow

Various errors encountered by tensorflow

2022-06-26 09:51:00 A cloud in the sky

Catalog

Version of the problem

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:


Version of the problem

Many errors are reported because of version problems ,TensorFlow Version of 、CUDA The version of . For example, the following example :

ImportError: Could not find 'cudart64_100.dll'

Need to download the corresponding CUDA edition .

Or go online to download cudart64_100.dll, copy to

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\10.1\Development\bin Under the table of contents

ImportError: cannot import name 'set_random_seed' from 'tensorflow' 

TensorFlow-GPU2.0 Encountered this problem in

2.0 New writing in :

import tensorflow
tensorflow.random.set_seed(x)

module ‘tensorflow’ has no attribute ‘ConfigProto’/'Session’

tensorflow2.0 The version is updated with the previous version , So change the above code to the following :

    # original edition  config = tf.ConfigProto(allow_soft_placement=True)
    config = tf.compat.v1.ConfigProto(allow_soft_placement=True)
    # original edition  sess = tf.Session(config=config)
    sess =tf.compat.v1.Session(config=config)  # Be careful  , Here for tensorflow2.0 edition , With the first 1.0 There is a gap .

`set_session` is not available when using TensorFlow 2.0

If you encounter an error like this , Will

keras.backend.tensorflow_backend.set_session(tf.compat.v1.Session(config=config))

Change it to

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:

The problem of path writing , Wrong writing

root_path = "../results/"

Write it correctly

root_path = "..\\results\\"

原网站

版权声明
本文为[A cloud in the sky]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260915129040.html