zoukankan      html  css  js  c++  java
  • Python运行tensortflow出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated;

    出错情况:

     可以看出是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,))])

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

  • 相关阅读:
    14.RabbitMQ
    13.跨域
    12.EF
    11.Redis
    GitHub获取用户ID
    10.AOP
    第26节课:pytest结合Allure操作
    第25节课:pytest测试框架
    第二十四节课:requests爬虫实战
    第二十三节课:正则表达式re模块:
  • 原文地址:https://www.cnblogs.com/1gaoyu/p/12591368.html
Copyright © 2011-2022 走看看