tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
186.3k stars 74.31k forks source link

tf.logging does not exist in tf 2.0, yet is used in example #26662

Closed serv-inc closed 5 years ago

serv-inc commented 5 years ago

Please make sure that this is a documentation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:doc_template

System information

Describe the documentation issue If you try to execute this code in a python REPL, it fails at

tf.logging.set_verbosity(tf.logging.ERROR)

with

AttributeError: 'module' object has no attribute 'logging'

We welcome contributions by users. Will you be able to update submit a PR (use the doc style guide) to fix the doc Issue?

Depends on how you want it. As of https://www.tensorflow.org/versions/r2.0/api_docs/python/tf, it seems the logging API does not exist. Of the methods in https://stackoverflow.com/questions/35911252/disable-tensorflow-debugging-information, only

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' 

worked.

jvishnuvardhan commented 5 years ago

@serv-inc Those examples are not related to TF2.0. Those examples uses Tensorflow master(TF1.13.1). In the example, import tensorflow as tf was used. For 2.0 we need to use, tensorflow==2.0.0-alpha0. Thanks!

serv-inc commented 5 years ago

@jvishnuvardhan : thank you for the explanation. This is a course about Tensorflow 2.0. I had only installed the 2.0 version on my system, which is why import tensorflow as tf used 2.0. Anyways, it seems to be a non-issue if this is simply not supposed to work in 2.0.

jvishnuvardhan commented 5 years ago

I am closing this issue as tf.logging is not there in TF2.0. Thanks!

MarkDaoust commented 5 years ago

I fixed this in all the examples I could find:

import logging
logger = tf.get_logger()
logger.setLevel(logging.ERROR)
amitport commented 4 years ago

@MarkDaoust is this documented somewhere?