Skip to content

Commit e01ed18

Browse files
Jonathan DEKHTIARzsdonghao
authored andcommitted
Logging fix (#661)
* `tf.logging` replaced by: `tl.logging` * Changelog updated
1 parent 4eb4dd7 commit e01ed18

27 files changed

+58
-57
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ To release a new version, please update the changelog as followed:
107107
- `tl.files` refactored into a directory with numerous files (by @DEKHTIARJonathan in #657)
108108
- `tl.files.voc_dataset` fixed because of original Pascal VOC website was down (by @DEKHTIARJonathan in #657)
109109
- extra requirements hidden inside the library added in the project requirements (by @DEKHTIARJonathan in #657)
110-
- requirements files refactored in `requirements/` directory (by @DEKHTIARJonathan in #657)
110+
- requirements files refactored in `requirements/` directory (by @DEKHTIARJonathan in #657)
111111
- README.md and other markdown files have been refactored and cleaned. (by @zsdonghao @DEKHTIARJonathan @luomai in #639)
112112
- Ternary Convolution Layer added in unittest (by @DEKHTIARJonathan in #658)
113113
- Convolution Layers unittests have been cleaned & refactored (by @DEKHTIARJonathan in #658)
@@ -124,6 +124,7 @@ To release a new version, please update the changelog as followed:
124124
- Typo of the document of ElementwiseLambdaLayer (by @zsdonghao in #588)
125125
- Error in `tl.layers.TernaryConv2d` fixed - self.inputs not defined (by @DEKHTIARJonathan in #658)
126126
- Deprecation warning fixed in `tl.layers.binary._compute_threshold()` (by @DEKHTIARJonathan in #658)
127+
- All references to `tf.logging` replaced by `tl.logging` (by @DEKHTIARJonathan in #661)
127128

128129
### Security
129130

example/tutorial_tfrecord3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ def prefetch_input_data(
260260
for pattern in file_pattern.split(","):
261261
data_files.extend(tf.gfile.Glob(pattern))
262262
if not data_files:
263-
tf.logging.fatal("Found no input files matching %s", file_pattern)
263+
tl.logging.fatal("Found no input files matching %s", file_pattern)
264264
else:
265-
tf.logging.info("Prefetching values from %d files matching %s", len(data_files), file_pattern)
265+
tl.logging.info("Prefetching values from %d files matching %s", len(data_files), file_pattern)
266266

267267
if is_training:
268268
print(" is_training == True : RandomShuffleQueue")

tensorlayer/nlp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ class Vocabulary(object):
273273

274274
def __init__(self, vocab_file, start_word="<S>", end_word="</S>", unk_word="<UNK>", pad_word="<PAD>"):
275275
if not tf.gfile.Exists(vocab_file):
276-
tf.logging.fatal("Vocab file %s not found." % vocab_file)
277-
tf.logging.info("Initializing vocabulary from file: %s" % vocab_file)
276+
tl.logging.fatal("Vocab file %s not found." % vocab_file)
277+
tl.logging.info("Initializing vocabulary from file: %s" % vocab_file)
278278

279279
with tf.gfile.GFile(vocab_file, mode="r") as f:
280280
reverse_vocab = list(f.readlines())
@@ -294,7 +294,7 @@ def __init__(self, vocab_file, start_word="<S>", end_word="</S>", unk_word="<UNK
294294

295295
logging.info("Vocabulary from %s : %s %s %s" % (vocab_file, start_word, end_word, unk_word))
296296
logging.info(" vocabulary with %d words (includes start_word, end_word, unk_word)" % len(vocab))
297-
# tf.logging.info(" vocabulary with %d words" % len(vocab))
297+
# tl.logging.info(" vocabulary with %d words" % len(vocab))
298298

299299
self.vocab = vocab # vocab[word] = id
300300
self.reverse_vocab = reverse_vocab # reverse_vocab[id] = word
@@ -1094,7 +1094,7 @@ def moses_multi_bleu(hypotheses, references, lowercase=False):
10941094
)
10951095
os.chmod(multi_bleu_path, 0o755)
10961096
except Exception: # pylint: disable=W0702
1097-
tf.logging.info("Unable to fetch multi-bleu.perl script, using local.")
1097+
tl.logging.info("Unable to fetch multi-bleu.perl script, using local.")
10981098
metrics_dir = os.path.dirname(os.path.realpath(__file__))
10991099
bin_dir = os.path.abspath(os.path.join(metrics_dir, "..", "..", "bin"))
11001100
multi_bleu_path = os.path.join(bin_dir, "tools/multi-bleu.perl")
@@ -1122,8 +1122,8 @@ def moses_multi_bleu(hypotheses, references, lowercase=False):
11221122
bleu_score = float(bleu_score)
11231123
except subprocess.CalledProcessError as error:
11241124
if error.output is not None:
1125-
tf.logging.warning("multi-bleu.perl script returned non-zero exit code")
1126-
tf.logging.warning(error.output)
1125+
tl.logging.warning("multi-bleu.perl script returned non-zero exit code")
1126+
tl.logging.warning(error.output)
11271127
bleu_score = np.float32(0.0)
11281128

11291129
# Close temp files

tests/test_array_ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def test_b4(self):
232232

233233
if __name__ == '__main__':
234234

235-
# tf.logging.set_verbosity(tf.logging.INFO)
236-
tf.logging.set_verbosity(tf.logging.DEBUG)
235+
# tl.logging.set_verbosity(tl.logging.INFO)
236+
tl.logging.set_verbosity(tl.logging.DEBUG)
237237

238238
unittest.main()

tests/test_layers_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_shape_n2(self):
5050

5151
if __name__ == '__main__':
5252

53-
# tf.logging.set_verbosity(tf.logging.INFO)
54-
tf.logging.set_verbosity(tf.logging.DEBUG)
53+
# tl.logging.set_verbosity(tl.logging.INFO)
54+
tl.logging.set_verbosity(tl.logging.DEBUG)
5555

5656
unittest.main()

tests/test_layers_convolution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def test_layer_n2(self):
244244

245245

246246
if __name__ == '__main__':
247-
# tf.logging.set_verbosity(tf.logging.INFO)
248-
tf.logging.set_verbosity(tf.logging.DEBUG)
247+
# tl.logging.set_verbosity(tl.logging.INFO)
248+
tl.logging.set_verbosity(tl.logging.DEBUG)
249249

250250
unittest.main()

tests/test_layers_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def test_net8(self):
199199

200200
if __name__ == '__main__':
201201

202-
# tf.logging.set_verbosity(tf.logging.INFO)
203-
tf.logging.set_verbosity(tf.logging.DEBUG)
202+
# tl.logging.set_verbosity(tl.logging.INFO)
203+
tl.logging.set_verbosity(tl.logging.DEBUG)
204204

205205
unittest.main()

tests/test_layers_extend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_params(self):
4949

5050
if __name__ == '__main__':
5151

52-
# tf.logging.set_verbosity(tf.logging.INFO)
53-
tf.logging.set_verbosity(tf.logging.DEBUG)
52+
# tl.logging.set_verbosity(tl.logging.INFO)
53+
tl.logging.set_verbosity(tl.logging.DEBUG)
5454

5555
unittest.main()

tests/test_layers_flow_control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_net_n_params(self):
6363

6464
if __name__ == '__main__':
6565

66-
# tf.logging.set_verbosity(tf.logging.INFO)
67-
tf.logging.set_verbosity(tf.logging.DEBUG)
66+
# tl.logging.set_verbosity(tl.logging.INFO)
67+
tl.logging.set_verbosity(tl.logging.DEBUG)
6868

6969
unittest.main()

tests/test_layers_importer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_slim_layer(self):
8383

8484
if __name__ == '__main__':
8585

86-
# tf.logging.set_verbosity(tf.logging.INFO)
87-
tf.logging.set_verbosity(tf.logging.DEBUG)
86+
# tl.logging.set_verbosity(tl.logging.INFO)
87+
tl.logging.set_verbosity(tl.logging.DEBUG)
8888

8989
unittest.main()

0 commit comments

Comments
 (0)