1 | torch_npu.profiler._KinetoProfile(activities=None, record_shapes=False, profile_memory=False, with_stack=False, with_flops=False, with_modules=False, experimental_config=None) |
提供PyTorch训练过程中的性能数据采集功能。
默认值为False。
开启torch_npu.profiler.ProfilerActivity.CPU时生效。
默认值为False。
默认值为False。
开启torch_npu.profiler.ProfilerActivity.CPU时生效。
默认值为False。
开启torch_npu.profiler.ProfilerActivity.CPU时生效。
1 2 3 4 5 6 7 8 9 10 11 12 13 | import torch import torch_npu ... prof = torch_npu.profiler._KinetoProfile(activities=None, record_shapes=False, profile_memory=False, with_stack=False, with_flops=False, with_modules=False, 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") |