• 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,))])

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

  • 相关阅读:
    CRM 2016 刷新 Iframe
    CRM 2016 升级CRM365之注意事项
    CRM 插件导出
    [LeetCode]Valid Sudoku
    [iOS]转:iOS最佳实践
    [LeetCode]Permutation Sequence
    [C/C++]函数可变参数表
    [LeetCode]Next Permutation
    [LeetCode]Remove Element
    [LeetCode]4Sum
  • 原文地址:https://www.cnblogs.com/1gaoyu/p/12591368.html
Copyright © 2020-2023  润新知