Numpy数据类型报错:FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated...

python为3.7.4,numpy为1.17.0,tensorflow为1.14.0

运行

import tensorflow as tf

之后,出现如下错误。

错误在dtypes.py文件中(第541行),使用 (type, 1) 或者 '1type' 作为类型代名词的方式已被弃用;在numpy的未来版本中,将会被理解成 (type, (1,)) 或者 '(1,)type'。

解决这个问题的方法是:

_np_qint8 = np.dtype([("qint8", np.int8, 1)])

改为

_np_qint8 = np.dtype([("qint8", np.int8, (1,))])

再次运行,就不会出现这个警告了。对后续相同的警告,采用如上相同的修改即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章