Shortcuts

mmagic.engine.hooks.iter_time_hook

Module Contents

Classes

IterTimerHook

IterTimerHooks inherits from mmengine.hooks.IterTimerHook and

Attributes

DATA_BATCH

mmagic.engine.hooks.iter_time_hook.DATA_BATCH[source]
class mmagic.engine.hooks.iter_time_hook.IterTimerHook[source]

Bases: mmengine.hooks.IterTimerHook

IterTimerHooks inherits from mmengine.hooks.IterTimerHook and overwrites self._after_iter().

This hooks should be used along with mmagic.engine.runner.MultiValLoop and mmagic.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” HistoryBuffer of runner.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 to mmagic.engine.runner.MultiValLoop.run() and mmagic.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’.

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.