[Enhancement] Align the evaluation result in log (#1034)

* align the evaluation result in log

* align the evaluation result in log

* align the evaluation result in log

* align the evaluation result in log

* fix test log_processor
This commit is contained in:
zhouhui 2023-04-04 00:17:42 +08:00 committed by GitHub
parent 0139e6eb15
commit 093068e4ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -307,6 +307,7 @@ class LogProcessor:
tag[key] = value
# Log other messages.
log_items = []
log_str += ' '
for name, val in chain(tag.items(), non_scalar_tag.items(),
time_tag.items()):
if isinstance(val, float):

View File

@ -164,14 +164,14 @@ class TestLogProcessor:
'cm: \ntensor([1, 2, 3])\n data_time: 1.0000')
if by_epoch:
if mode == 'test':
assert out == 'Epoch(test) [5/5] ' + expect_metric_str
assert out == 'Epoch(test) [5/5] ' + expect_metric_str
else:
assert out == 'Epoch(val) [1][10/10] ' + expect_metric_str
assert out == 'Epoch(val) [1][10/10] ' + expect_metric_str
else:
if mode == 'test':
assert out == 'Iter(test) [5/5] ' + expect_metric_str
assert out == 'Iter(test) [5/5] ' + expect_metric_str
else:
assert out == 'Iter(val) [10/10] ' + expect_metric_str
assert out == 'Iter(val) [10/10] ' + expect_metric_str
def test_collect_scalars(self):
history_count = np.ones(100)