文|seraph
-
AttributeError: module 'tensorflow' has no attribute 'sub'
解決:將tf.sub
換成tf.subtract
。 -
AttributeError: module 'tensorflow' has no attribute 'mul'
解決:將tf.mul
換成tf.multiply
-
AttributeError: module 'tensorflow' has no attribute 'types'
解決:將tf.types.float32
換成tf.float32
-
TensorFlow please use urllib or similar directly
解決:在from tensorflow.examples.tutorials.mnist import input_data
之前,加入
old_v = tf.logging.get_verbosity()
tf.logging.set_verbosity(tf.logging.ERROR)
在mnist = input_data.read_data_sets('./data/mnist', one_hot=True)
之後,加入
tf.logging.set_verbosity(old_v)
Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
解決:添加動態申請顯存的代碼即可
config = ConfigProto()
config.gpu_options.allow_growth = True
- 執行
for k, v in six.iteritems(FLAGS.__dict__['__flags']):
報錯誤:KeyError: '__flags'
。
解決:將循環語句修改爲
for k in FLAGS:
v = FLAGS[k].value
-
已經安裝tensorflow,但是報:
ImportError: No module named tensorflow
。
解決:可能安裝的使python3版本的,使用python3執行py文件即可。或者調整python默認版本爲python3。 -
Could not dlopen library 'libcudart.so.10.0';
解決:查看CUDA是否安裝,如已經安裝,檢查是否是10.0
版本的。
也可能沒有配好LIB_LIBRARY_PATH
環境變量,導致不能搜索到文件。 -
CUDA driver version is insufficient for CUDA runtime version
解決:如提示所示,NVIDIA驅動和CUDA版本不兼容。使用nvidia-smi
查看驅動和CUDA版本是否符合如下圖所示:
詳細內容可以參考官網 -
*** Error in 'python': free(): invalid pointer
解決:apt-get install libtcmalloc-minimal4
。
然後在加入環境變量:
export LD_PRELOAD="/usr/lib/libtcmalloc_minimal.so.4"
-
could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
解決:具體問題未能完全定位,可能是顯存不夠,但加入下面按需申請顯存代碼,暫時能正常運行。
config = ConfigProto()
config.gpu_options.allow_growth = True
tf.Session(config=config) #在設置會話加入配置即可。