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

Posted 一往无前!

tags:

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

出错情况:

 

 可以看出是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 dep的主要内容,如果未能解决你的问题,请参考以下文章

python concurrent.futures

14.Java中的Future模式

python爬虫运行出现这种问题怎么办!

Python 运行报错NameError出现原因,怎么解决

python 脚本长时间运行出现python已停止工作?

Python脚本运行出现语法错误:IndentationError:unexpected indent