Skip to content

Commit 358a811

Browse files
committed
Move logger configuration to beggeing of file
1 parent b09867d commit 358a811

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/data/tensorflow_mnist/mnist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
import logging as _logging
2525
import sys as _sys
2626

27+
tf.logging.set_verbosity(tf.logging.DEBUG)
28+
_handler = _logging.StreamHandler(_sys.stdout)
29+
tf_logger = tf_logging._get_logger()
30+
tf_logger.handlers = [_handler]
2731

2832
def cnn_model_fn(features, labels, mode):
2933
"""Model function for CNN."""
@@ -147,10 +151,6 @@ def serving_input_fn():
147151

148152
if __name__ == "__main__":
149153
args, unknown = _parse_args()
150-
tf.logging.set_verbosity(tf.logging.DEBUG)
151-
_handler = _logging.StreamHandler(_sys.stdout)
152-
tf_logger = tf_logging._get_logger()
153-
tf_logger.handlers = [_handler]
154154

155155
if args.model_dir.startswith('s3://'):
156156
os.environ['S3_REGION'] = 'us-west-2'

0 commit comments

Comments
 (0)