Browse Source

!2515 Avoid extra recording of summary when end called

Merge pull request !2515 from 李鸿章/no_step_zero
tags/v0.5.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
375f2bfa61
2 changed files with 5 additions and 0 deletions
  1. +2
    -0
      mindspore/train/callback/_summary_collector.py
  2. +3
    -0
      mindspore/train/summary/summary_record.py

+ 2
- 0
mindspore/train/callback/_summary_collector.py View File

@@ -308,6 +308,8 @@ class SummaryCollector(Callback):
else:
self._collect_eval_lineage(cb_params)

# This is a workaround to avoid record '_summary_tensor_cache'.
self._record.set_mode('eval')
# There's nothing special about setting step to 0 here, just to satisfy the interface call
self._record.record(step=0)



+ 3
- 0
mindspore/train/summary/summary_record.py View File

@@ -202,6 +202,9 @@ class SummaryRecord:
if not isinstance(value, Tensor):
raise TypeError(f'Expect the value to be Tensor, but got {type(value).__name__}')
np_value = _check_to_numpy(plugin, value)
if name in {item['tag'] for item in self._data_pool[plugin]}:
entry = repr(f'{name}/{plugin}')
logger.warning(f'{entry} has duplicate values. Only the newest one will be recorded.')
self._data_pool[plugin].append(dict(tag=name, mode=self._mode, value=np_value))

elif plugin in ('train_lineage', 'eval_lineage', 'dataset_graph', 'custom_lineage_data'):


Loading…
Cancel
Save