【问题标题】:TensorFlow Net disable log informationTensorFlow Net 禁用日志信息
【发布时间】:2022-11-29 11:31:25
【问题描述】:

如何禁用控制台中的tenserflow信息输出 尝试将环境“TF_CPP_MIN_LOG_LEVEL”更改为 3 看了网上的答案,发现只有Python

2022-10-20 22:31:27.972310: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x22ca2648990 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-10-20 22:31:27.972477: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version

【问题讨论】:

    标签: c# tensorflow


    【解决方案1】:

    我们可以使用 TF_CPP_MIN_LOG_LEVEL 环境变量来禁用调试信息。可以在导入 TensorFlow 之前设置。

    import os
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
    import tensorflow as tf
    

    或者在运行 Python 脚本之前手动设置此环境变量。

    SET TF_CPP_MIN_LOG_LEVEL=1
    python main.py
    

    更多详情请参考document。谢谢你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-09-29
      • 2016-06-24
      • 2019-12-23
      • 2015-11-14
      • 1970-01-01
      • 1970-01-01
      • 2018-09-02
      相关资源
      最近更新 更多