警告如下:
>>> import tensorflow as tf
/Users/liaowenbin/anaconda3/envs/dl/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py:455: 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)])
/Users/liaowenbin/anaconda3/envs/dl/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py:456: 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)])
/Users/liaowenbin/anaconda3/envs/dl/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py:457: 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)])
/Users/liaowenbin/anaconda3/envs/dl/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py:458: 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)])
/Users/liaowenbin/anaconda3/envs/dl/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py:459: 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)])
解決方法:
1、打開你路徑下的dtypes.py文件
gedit 你的路徑/dtypes.py
2、修改各個被警告行數的代碼 1改爲(1,)
原來:_np_qint8 = np.dtype([("qint8", np.int8, 1])
修改爲:_np_qint8 = np.dtype([("qint8", np.int8, (1,))])