警告如下:
>>> 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,))])