1 | torch_npu.profiler.ProfilerLevel |
采集等级,Enum类型。用于作为 _ExperimentalConfig类的profiler_level参数。
默认值为Level0。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import torch import torch_npu ... experimental_config = torch_npu.profiler._ExperimentalConfig( profiler_level=torch_npu.profiler.ProfilerLevel.Level0 ) with torch_npu.profiler.profile( on_trace_ready=torch_npu.profiler.tensorboard_trace_handler("./result"), experimental_config=experimental_config) as prof: for step in range(steps): # 训练函数 train_one_step() # 训练函数 prof.step() |