码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2020-03-29 12:20:55      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:mod   res   struct   handle   warning   color   import   pass   war   

出错情况:

技术图片

 

 可以看出是dtypes的文件中出现问题:

问题的位置:

_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)])

# _np_bfloat16 is defined by a module import.

# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, 1)])

修改方法,将里面的1改为(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,))])

# _np_bfloat16 is defined by a module import.

# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, (1,))])

重新运行会发现警告消失:

技术图片

 

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

标签:mod   res   struct   handle   warning   color   import   pass   war   

原文地址:https://www.cnblogs.com/1gaoyu/p/12591368.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!