下载
中文
注册

torch_npu.profiler.dynamic_profile.init

接口原型

torch_npu.profiler.dynamic_profile.init(path: str)

功能描述

初始化dynamic_profile动态采集。

参数说明

path:dynamic_profile会在path下自动创建模板文件profiler_config.json,用户可基于模板文件自定义修改配置项。profiler_config_path路径格式仅支持由字母、数字和下划线组成的字符串,不支持软链接。必选。

profiler_config.json文件详细介绍请参见《CANN 性能调优工具指南》中的“使用PyTorch框架接口采集”章节

支持的型号

  • Atlas 训练系列产品
  • Atlas A2 训练系列产品

调用示例

1
2
3
4
5
6
7
8
9
# 加载dynamic_profile模块
from torch_npu.profiler import dynamic_profile as dp
# 设置Profiling配置文件的路径
dp.init("profiler_config_path")

for step in steps:
	train_one_step()
	# 划分step
	dp.step()