torch_npu.profiler._KinetoProfile

接口原型

torch_npu.profiler.profile(activities=None, record_shapes=False, profile_memory=False, with_stack=False, with_flops, experimental_config=None)

功能描述

提供PyTorch训练过程中的性能数据采集功能。

参数说明

调用示例

import torch
import torch_npu

...

prof = torch_npu.profiler._KinetoProfile(activities=None, record_shapes=False, profile_memory=False, with_stack=False, with_flops, experimental_config=None)
for epoch in range(epochs):
        train_model_step()
        if epoch == 0:
                prof.start()
        if epoch == 1:
                prof.stop()
prof.export_chrome_trace("result_dir/trace.json")