import tensorflow as tf 出现警告it will be understood as (type, (1,)) / '(1,)type'.

警告如下:

>>> 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,))])
发布了52 篇原创文章 · 获赞 40 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/weixin_40519315/article/details/104288178