-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated silence tensorflow for tensorflow 2.0
- Loading branch information
1 parent
da9c303
commit 6a51f91
Showing
10 changed files
with
20 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,4 @@ | |
|
||
.notipy.json | ||
\.DS_Store | ||
|
||
|
||
*.egg-info |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import os | ||
os.environ["KMP_AFFINITY"] = "noverbose" | ||
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' | ||
import warnings | ||
warnings.simplefilter(action='ignore', category=FutureWarning) | ||
warnings.simplefilter(action='ignore', category=DeprecationWarning) | ||
import tensorflow as tf | ||
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) | ||
from .silence_tensorflow import silence_tensorflow | ||
|
||
__all__ = [ | ||
"silence_tensorflow" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
import logging | ||
|
||
|
||
def silence_tensorflow(): | ||
"""Silence every warning of notice from tensorflow.""" | ||
logging.getLogger('tensorflow').setLevel(logging.ERROR) | ||
os.environ["KMP_AFFINITY"] = "noverbose" | ||
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' | ||
import tensorflow as tf | ||
tf.get_logger().setLevel('ERROR') | ||
tf.autograph.set_verbosity(3) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import silence_tensorflow | ||
import os | ||
from silence_tensorflow import silence_tensorflow | ||
|
||
def test_silence_tensorflow(): | ||
"""Check that everything runs.""" | ||
assert os.environ["KMP_AFFINITY"] == "noverbose" | ||
assert os.environ["TF_CPP_MIN_LOG_LEVEL"] == "2" | ||
silence_tensorflow() |