最近執行Tensorflow程序出現如下警告信息
D:\python36\lib\site-packages\tensorflow\python\framework\dtypes.py:493: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) D:\python36\lib\site-packages\tensorflow\python\framework\dtypes.py:494: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) D:\python36\lib\site-packages\tensorflow\python\framework\dtypes.py:495: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) D:\python36\lib\site-packages\tensorflow\python\framework\dtypes.py:496: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) D:\python36\lib\site-packages\tensorflow\python\framework\dtypes.py:497: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) D:\python36\lib\site-packages\tensorflow\python\framework\dtypes.py:502: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) 2019-10-16 10:47:11.344409: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX
網上查發現numpy的版本過高了我安裝的版本是1.17.2,將版本到1.16.0就FutureWarning不在顯示了
pip uninstall numpy # 卸載numpy pip install numpy==1.16.0 # 安裝指定版本的numpy
然后最下面的。。。not compiled to use: AVX警告信息通過添加如下方式忽略
import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
這里的2代表是如下
# TF_CPP_MIN_LOG_LEVEL = 1 //默認設置,為顯示所有信息
# TF_CPP_MIN_LOG_LEVEL = 2 //只顯示error和warining信息
# TF_CPP_MIN_LOG_LEVEL = 3 //只顯示error信息
這樣就不再顯示啟動強迫症的紅色警告信息!!!
參考GodLordGee的筆記:https://blog.csdn.net/GodLordGee/article/details/100579932
謝謝GodLordGee兄弟。