【问题标题】:How to suppress "Future warning" tensorflow?如何抑制“未来警告”张量流?
【发布时间】:2020-01-02 09:21:49
【问题描述】:

我正在 ubuntu 终端上运行使用 TensorFlow 的“./buildTF.sh”。并得到错误:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516:
FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated;
in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

【问题讨论】:

标签: python numpy tensorflow ubuntu terminal


【解决方案1】:

这是由于 numpy 版本而出现的警告消息,请卸载当前的 numpy 版本并将其更新为1.16.4

# pip uninstall numpy 
# pip install numpy==1.16.4

感谢ymodak

【讨论】:

    【解决方案2】:

    这些警告是经典的 FutureWarning,这意味着您可以使用 python 标准库中的 warnings 模块将它们静音:

    import warnings
    warnings.filterwarnings("ignore", message=r"Passing", category=FutureWarning)
    

    这将检查FutureWarning 并将包含r"Passing" 的消息静音。

    【讨论】:

    • 不适用于 tf 1.14
    【解决方案3】:

    如果和张量流有关,可以使用如下代码: 导入日志 logging.getLogger('tensorflow').disabled = True

    【讨论】:

      猜你喜欢
      • 2019-05-19
      • 1970-01-01
      • 2015-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-25
      • 2011-03-18
      相关资源
      最近更新 更多