close

Tensorflow默認的logging/warning information太多 ,看著總是很煩,解決方法很簡單,只要在程式碼中添加這兩行就可以擺脫這些煩人的提示

Python:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'  

TF_CPP_MIN_LOG_LEVEL默認值為 0 (顯示所有logs),設置為 1 隱藏 INFO logs, 2 額外隱藏WARNING logs, 設置為3所有 ERROR logs也不顯示。

 

小筆記:

import os

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

這兩行要在import tensorflow as tf之前,不然的話tensorflow除錯訊息還是會跳出喔

 

補充(來源: https://stackoverflow.com/questions/35911252/disable-tensorflow-debugging-information )

0 = all messages are logged (default behavior)
1 = INFO messages are not printed
2 = INFO and WARNING messages are not printed
3 = INFO, WARNING, and ERROR messages are not printed

arrow
arrow

    低階ㄇㄋ 發表在 痞客邦 留言(0) 人氣()