mmagic.engine.hooks.iter_time_hook¶
Module Contents¶
Classes¶
IterTimerHooks inherits from |
Attributes¶
- class mmagic.engine.hooks.iter_time_hook.IterTimerHook[source]¶
Bases:
mmengine.hooks.IterTimerHookIterTimerHooks inherits from
mmengine.hooks.IterTimerHookand overwritesself._after_iter().This hooks should be used along with
mmagic.engine.runner.MultiValLoopandmmagic.engine.runner.MultiTestLoop.- _after_iter(runner, batch_idx: int, data_batch: DATA_BATCH = None, outputs: Optional[Union[dict, Sequence[mmengine.structures.BaseDataElement]]] = None, mode: str = 'train') None[source]¶
Calculating time for an iteration and updating “time”
HistoryBufferofrunner.message_hub. If mode is ‘train’, we take runner.max_iters as the total iterations and calculate the rest time. If mode in val or test, we use runner.val_loop.total_length or runner.test_loop.total_length as total number of iterations. If you want to know how total_length is calculated, please refers tommagic.engine.runner.MultiValLoop.run()andmmagic.engine.runner.MultiTestLoop.run().- Parameters
runner (Runner) – The runner of the training validation and testing process.
batch_idx (int) – The index of the current batch in the loop.
data_batch (Sequence[dict], optional) – Data from dataloader. Defaults to None.
outputs (dict or sequence, optional) – Outputs from model. Defaults to None.
mode (str) – Current mode of runner. Defaults to ‘train’.