如何去掉tf.logging.info打印出来的前缀
How to remove the prefix printed out by tf.logging.info
在 TensorFlow 中打印日志行是通过 tf.logging 中的函数完成的,例如 tf.logging.info、tf.logging.log 等
import tensorflow as tf;
tf.logging.set_verbosity(tf.logging.INFO);
tf.logging.info(tf.__version__);
然而,当在 Google Colab 上打印时,在打印值之前有一个很长的前缀:
I0903 10:16:46.097078 140433498875776 <ipython-input-9-a435f70e3dca>:22] 1.14.0
如何更改 tf.logging 以省略该前缀?它很长而且没有必要。即使在终端中 运行 直接使用 python3
的代码,仍然有一个较短的前缀(终端中的版本为 1.12.0):
INFO:tensorflow: 1.12.0
我也想删除这个短前缀。
我终于找到答案,无法通过tf.logging.*
函数删除前缀。它是在库的 C/C++ 级别完成的,无法删除它。
在 TensorFlow 中打印日志行是通过 tf.logging 中的函数完成的,例如 tf.logging.info、tf.logging.log 等
import tensorflow as tf;
tf.logging.set_verbosity(tf.logging.INFO);
tf.logging.info(tf.__version__);
然而,当在 Google Colab 上打印时,在打印值之前有一个很长的前缀:
I0903 10:16:46.097078 140433498875776 <ipython-input-9-a435f70e3dca>:22] 1.14.0
如何更改 tf.logging 以省略该前缀?它很长而且没有必要。即使在终端中 运行 直接使用 python3
的代码,仍然有一个较短的前缀(终端中的版本为 1.12.0):
INFO:tensorflow: 1.12.0
我也想删除这个短前缀。
我终于找到答案,无法通过tf.logging.*
函数删除前缀。它是在库的 C/C++ 级别完成的,无法删除它。