深度學習9 TensorFlow常見報錯及解決方法

2021-08-16 07:50:45 字數 1514 閱讀 9100

在使用tensorflow時,經常會看到這樣那樣的報錯,這裡記錄一下,免得每次看到都得去網上搜。這些問題中,很多是版本問題導致的。

1.argumenterror: argument –epoch: conflicting option string: –epoch

報錯原因:

中有網友解釋如下:

因為你沒有真正訓練起來,每次開始訓練之後如果沒有在checkpoint中生成模型,就需要刪除這個資料夾才可以重新開始執行,真正開始訓練後,一旦停止,會在checkpoint中生成乙個model, 由於你再次執行之前沒有model,所以引數都沒有初始化,所以出現了這個錯誤。

解決方法:

在sypder中restart kernel

2.attributeerror: module 『tensorflow』 has no attribute 『image_summary』

報錯原因:

版本問題。

解決方法:

tf.image_summary('images', images)改為:tf.summary.image('images', images)

3.attributeerror: module 『tensorflow』 has no attribute 『scalar_summary』

報錯原因:

版本問題。

解決方法:

tf.scalar_summary('images', images)改為:tf.summary.scalar('images', images)

4.an exception has occurred, use %tb to see the full traceback. systemexit d:\anaconda3\lib\site-packages\ipython\core\interactiveshell.py:2870: userwarning: to exit: use 『exit』, 『quit』, or ctrl-d. warn(「to exit: use 『exit』, 『quit』, or ctrl-d.」, stacklevel=1)

報錯原因:

spyder ide封裝問題。中有詳細解釋。

這個問題不會影響執行結果。

5.typeerror: reduce_sum() got an unexpected keyword argument 『reduction_indies』

報錯原因:

版本問題。

解決方法:

tf.reduce_sum引數的reduction_indies改為axis

tf.reduce_***操作均如此修改。

9 TensorFLow 中的決策函式

神經網路的輸出 logits tf.constant 3.0 1.0,3.0 正確的標籤 y tf.constant 1.0 0.0 0.0 神經網路的輸出經過 softmax 變換得到每個類別的概率 y tf.nn.softmax logits array 0.87887824 0.1189432...

TensorFlow 深度學習筆記

google 深度學習筆記 經常總結是個好習慣,筆記目錄奉上。歡迎star,有問題可以到issue區討論 官方教程位址 最近tensorflow團隊出了乙個model專案,和這個課程無關,但是可以參考 框架 tensorflow 谷歌出品的基於python的深度學習工具集 工具 ipython,py...

TensorFlow深度學習框架

tensorflow支援python和c 兩種程式語言,再複雜的多層神經網路模型都可以用python來實現,如果業務使用其他程式設計也不用擔心,使用跨語言的grpc或者http服務也可以訪問使用tensorflow訓練好的智慧型模型。tensorflow 是乙個採用資料流圖 data flow gr...