FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future

Posted gengyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future相关的知识,希望对你有一定的参考价值。

关于报错信息

C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\python.exe E:/RBM_tf2.0_CNN/rmb_my/model_use.py
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:516: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:517: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:518: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:519: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:520: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:525: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:541: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:542: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:543: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:544: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:545: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:550: 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)])

原文

C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\python.exe E:/RBM_tf2.0_CNN/rmb_my/model_use.py
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:516: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:517: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:518: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:519: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:520: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:525: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:541: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:542: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:543: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:544: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:545: 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)])
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:550: 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)])

 

我们打开红色位置文件名,就可以打开对应文件并定位到相应位置,此时我们打开相应位置,按照报错进行修改即可。

不赞成将  (type, 1) or 1type  作为类型的同义词进行传递,在 numpy的未来版本中,它们将被理解为 (type, (1,)) / (1,)type 。

错误代码为 _np_qint8 = np.dtype([("qint8", np.int8, 1)]) 

逐个修改(仅部分展示)

_np_qint8 = np.dtype([("qint8", np.int8, (1,))])
_np_quint8 = np.dtype([("quint8", np.uint8, (1,))])
_np_qint16 = np.dtype([("qint16", np.int16, (1,))])
_np_quint16 = np.dtype([("quint16", np.uint16, (1,))])
_np_qint32 = np.dtype([("qint32", np.int32, (1,))])

源代码

技术图片

 

 

改完之后,完美解决

 

以上是关于FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future的主要内容,如果未能解决你的问题,请参考以下文章

Python运行tensortflow出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is dep

FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future

TensorFlow忽略警告信息:FutureWarning

WDL-训练模型

WDL-训练模型

FutureWarning 未与 warnings.simplefilter(action = "error", category=FutureWarning) 一起显示