mindquantum.utils.SingleLoopProgress

View Source On Gitee
class mindquantum.utils.SingleLoopProgress(n_loop: int, loop_name: str = 'Task')[source]

A progress bar of task with single level for loop.

Parameters
  • n_loop (int) – Total loop size.

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

Examples

>>> import time
>>> from mindquantum.utils import SingleLoopProgress
>>> with SingleLoopProgress(100) as progress:
>>>     for batch in range(100):
>>>         progress.update_loop(batch)
>>>         time.sleep(0.01)
update_loop(loop_idx: int)[source]

Update loop progress bar.

Parameters

loop_idx (int) – The index of loop.