mindquantum.utils.TwoLoopsProgress

View Source On Gitee
class mindquantum.utils.TwoLoopsProgress(n_outer_loop: int, n_inner_loop: int, outer_loop_name: str = 'Epoch', inner_loop_name: str = 'Batch')[source]

A progress bar of task with two level for loops.

Parameters
  • n_outer_loop (int) – Total loop size of outer loop.

  • n_inner_loop (int) – Total loop size of inner loop.

  • outer_loop_name (str) – The name that will be shown as the title of outer loop progress bar. Default: "Epoch".

  • inner_loop_name (str) – The name that will be shown as the title of inner loop progress bar. Default: "Batch".

Examples

>>> import time
>>> from mindquantum.utils import TwoLoopsProgress
>>> with TwoLoopsProgress(3, 100) as progress:
>>>     for ep in range(3):
>>>         for batch in range(100):
>>>             progress.update_inner_loop(batch)
>>>             time.sleep(0.01)
>>>         progress.update_outer_loop(ep)
update_inner_loop(loop_idx: int)[source]

Update inner loop progress bar.

Parameters

loop_idx (int) – The index of inner loop.

update_outer_loop(loop_idx: int)[source]

Update outer loop progress bar.

Parameters

loop_idx (int) – The index of outer loop.