简体   繁体   English

有没有一种很好的方法来着色tf.logging(tensorflow终端打印)?

[英]Is there a good way of coloring tf.logging (tensorflow terminal printing)?

I am an intense Tensorflow user. 我是Tensorflow的忠实用户。 So far, when I need to print something, I used to use the logging library with coloredlogs . 到目前为止,当我需要打印某些内容时,我曾经使用了带有coloredlogslogging库。 These are very useful, and I could see what is going on more easily: 这些非常有用,我可以很容易地看到正在发生的事情:

import logging
import coloredlogs
logger = logging.getLogger(__name__)
coloredlogs.install(level='DEBUG', logger=logger, ...)
logger.debug("-- preparing network..")   <-- eg, debug in green, info in cyan, ...

However, Tensorflow actually provides built-in tf.logging . 但是,Tensorflow实际上提供了内置的tf.logging For compatibility, I decided to use it. 为了兼容性,我决定使用它。 In this case, is there a way that I can assign some colors to tf.logging.{debug, info, warning, ...} ? 在这种情况下,是否可以为tf.logging.{debug, info, warning, ...}分配一些颜色tf.logging.{debug, info, warning, ...}

The module coloredlogs works for Tenosorflow in-built logging too. 另外,coloredlogs模块也适用于Tenosorflow内置日志记录。

from tensorflow import logging
coloredlogs.install(level='DEBUG')
tf.logging.set_verbosity(tf.logging.DEBUG)

I tried this. 我试过了 Working perfectly. 工作正常。 But you should set both logging verbosity to same. 但是您应该将两个日志记录的详细程度都设置为相同。 Or coloredlogs log verbosity should be higher. 或彩色日志的详细程度应更高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 jupyter notebook 中使用着色而不是黑白打印 logging.exception - printing logging.exception in jupyter notebook with coloring instead of black and white 该代码片段在tensorflow代码中表示“tf.logging.set_verbosity(tf.logging.INFO)”是什么? - What does that code snippet signify “tf.logging.set_verbosity(tf.logging.INFO)” in tensorflow code? 正确记录和打印到控制台的方法 - Proper way of logging and printing to console Tensorflow 2.0.0-alpha0:tf.logging.set_verbosity - Tensorflow 2.0.0-alpha0: tf.logging.set_verbosity 有没有办法找出哪个 function 正在打印到终端? - Is there a way to find out which function is printing to the terminal? 如何在张量流中填充不规则形状的张量(纯TF方式)? - How to pad a irregular shape tensor in tensorflow (pure TF way)? 有没有办法在 Tensorflow 的另一个数据集中使用 tf.data.Dataset? - Is there a way to use tf.data.Dataset inside of another Dataset in Tensorflow? Tensorflow:有没有办法在 tf.Estimator 中存储训练损失 - Tensorflow: Is there a way to store the training loss in tf.Estimator 从终端上的Python着色异常 - Coloring exceptions from Python on a terminal 在Python中打印时处理NoneType对象的好方法 - Good way of handling NoneType objects when printing in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM