解决python调用TensorFlow时出现FutureWarning: Passing (type, 1) or ‘1type‘ as a synonym of type is deprecate

叁歲伎倆 2023-07-15 19:16 13阅读 0赞

运行代码报错
解决办法:点击蓝色链接进入dtypes.py文件修改下方代码

  1. _np_qint8 = np.dtype([("qint8", np.int8, 1)])
  2. _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
  3. _np_qint16 = np.dtype([("qint16", np.int16, 1)])
  4. _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
  5. _np_qint32 = np.dtype([("qint32", np.int32, 1)])
  6. # _np_bfloat16 is defined by a module import.
  7. # Custom struct dtype for directly-fed ResourceHandles of supported type(s).
  8. np_resource = np.dtype([("resource", np.ubyte, 1)])

修改部分:1——>(1,)

  1. _np_qint8 = np.dtype([("qint8", np.int8, (1,))])
  2. _np_quint8 = np.dtype([("quint8", np.uint8, (1,))])
  3. _np_qint16 = np.dtype([("qint16", np.int16, (1,))])
  4. _np_quint16 = np.dtype([("quint16", np.uint16, (1,))])
  5. _np_qint32 = np.dtype([("qint32", np.int32, (1,))])
  6. # _np_bfloat16 is defined by a module import.
  7. # Custom struct dtype for directly-fed ResourceHandles of supported type(s).
  8. np_resource = np.dtype([("resource", np.ubyte, (1,))])

成功运行!

发表评论

表情:
评论列表 (有 0 条评论,13人围观)

还没有评论,来说两句吧...

相关阅读