mindquantum.utils.TwoLoopsProgress
- class mindquantum.utils.TwoLoopsProgress(n_outer_loop: int, n_inner_loop: int, outer_loop_name: str = 'Epoch', inner_loop_name: str = 'Batch')[源代码]
一个用于展示拥有两层循环任务的进度的进度条。
- 参数:
n_outer_loop (int) - 外层循环的个数。
n_inner_loop (int) - 内层循环的个数。
outer_loop_name (str) - 外层循环的进度条的标题。默认值:
"Epoch"
。inner_loop_name (str) - 内层循环的进度条的标题。默认值:
"Batch"
。
样例:
>>> 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)