1 | torch_npu.profiler.schedule (wait, active, warmup = 0, repeat = 0, skip_first = 0) |
设置不同step的行为。用于构造torch_npu.profiler.profile的schedule参数。
默认不执行schedule操作。
1 2 3 4 5 6 7 8 9 10 11 12 | import torch import torch_npu ... with torch_npu.profiler.profile( schedule=torch_npu.profiler.schedule(wait=0, warmup=0, active=1, repeat=1, skip_first=1), on_trace_ready=torch_npu.profiler.tensorboard_trace_handler("./result") ) as prof: for step in range(steps): # 训练函数 train_one_step() # 训练函数 prof.step() |