torch_npu.profiler.ProfilerAction

接口原型

1
torch_npu.profiler.ProfilerAction

功能描述

Profiler状态,Enum类型。

参数说明

支持的型号

调用示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import torch
import torch_npu

...

torch_npu.profiler.ProfilerAction.WARMUP
with torch_npu.profiler.profile(
    on_trace_ready=torch_npu.profiler.tensorboard_trace_handler("./result")
    ) as prof:
            for step in range(steps): # 训练函数
                train_one_step() # 训练函数
                prof.step()