mmedit.engine.hooks.iter_time_hook¶
Module Contents¶
Classes¶
EditIterTimerHooks inherits from |
Attributes¶
- class mmedit.engine.hooks.iter_time_hook.EditIterTimerHook[源代码]¶
Bases:
mmengine.hooks.IterTimerHookEditIterTimerHooks inherits from
mmengine.hooks.IterTimerHookand overwritesself._after_iter().This hooks should be used along with
mmedit.engine.runner.GenValLoopandmmedit.engine.runner.GenTestLoop.- _after_iter(runner, batch_idx: int, data_batch: DATA_BATCH = None, outputs: Optional[Union[dict, Sequence[mmengine.structures.BaseDataElement]]] = None, mode: str = 'train') None[源代码]¶
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 tommedit.engine.runner.GenValLoop.run()andmmedit.engine.runner.GenTestLoop.run().- 参数
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’.