简体   繁体   中英

How to remove the prefix printed out by tf.logging.info

Printing log lines in TensorFlow is done with functions in tf.logging like tf.logging.info, tf.logging.log, etc.

import tensorflow as tf;

tf.logging.set_verbosity(tf.logging.INFO);
tf.logging.info(tf.__version__);

However, when printing on Google Colab , there's a real long prefix before the printed value:

I0903 10:16:46.097078 140433498875776 <ipython-input-9-a435f70e3dca>:22] 1.14.0

How to change tf.logging to omit that prefix? It's long and unnecessary. And even when running the code directly with python3 in terminal, there's still a shorter prefix (the version is 1.12.0 in terminal):

INFO:tensorflow: 1.12.0

And I want to remove this short prefix too.

I finally found the answer that it is impossible to remove the prefix by tf.logging.* functions. It is a done in the C/C++ level of the library and no way to remove it.

It is stated in there: https://github.com/tensorflow/tensorflow/issues/12537

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM