Add absl logging functions to the output_streams supported by tf.print (v2). This ensures we can print to these streams without needing to use tf.compat.v1
PiperOrigin-RevId: 258360763
This commit is contained in:
parent
2ba24e8d89
commit
b542d67952
@ -23,6 +23,7 @@ import pprint
|
||||
import random
|
||||
import sys
|
||||
|
||||
from absl import logging
|
||||
import six
|
||||
|
||||
from tensorflow.python import pywrap_tensorflow
|
||||
@ -221,10 +222,10 @@ def print_v2(*inputs, **kwargs):
|
||||
ways), and printable python objects.
|
||||
output_stream: The output stream, logging level, or file to print to.
|
||||
Defaults to sys.stderr, but sys.stdout, tf.compat.v1.logging.info,
|
||||
tf.compat.v1.logging.warning, and tf.compat.v1.logging.error are also
|
||||
supported. To print to
|
||||
a file, pass a string started with "file://" followed by the file path,
|
||||
e.g., "file:///tmp/foo.out".
|
||||
tf.compat.v1.logging.warning, tf.compat.v1.logging.error,
|
||||
absl.logging.info, absl.logging.warning and absl.loogging,error are also
|
||||
supported. To print to a file, pass a string started with "file://"
|
||||
followed by the file path, e.g., "file:///tmp/foo.out".
|
||||
summarize: The first and last `summarize` elements within each dimension are
|
||||
recursively printed per Tensor. If None, then the first 3 and last 3
|
||||
elements of each dimension are printed for each tensor. If set to -1, it
|
||||
@ -268,6 +269,15 @@ def print_v2(*inputs, **kwargs):
|
||||
tf_logging.warn: "log(warning)",
|
||||
tf_logging.ERROR: "log(error)",
|
||||
tf_logging.error: "log(error)",
|
||||
logging.INFO: "log(info)",
|
||||
logging.info: "log(info)",
|
||||
logging.INFO: "log(info)",
|
||||
logging.WARNING: "log(warning)",
|
||||
logging.WARN: "log(warning)",
|
||||
logging.warning: "log(warning)",
|
||||
logging.warn: "log(warning)",
|
||||
logging.ERROR: "log(error)",
|
||||
logging.error: "log(error)",
|
||||
}
|
||||
|
||||
if _is_filepath(output_stream):
|
||||
|
Loading…
x
Reference in New Issue
Block a user