megengine.utils.profiler.Profiler

class Profiler(path='profile', format='chrome_timeline.json', *, topic=34, align_time=True, show_operator_name=True)[源代码]

基类:object

imperative模式下对图执行进行性能分析。

参数

path (str) – 性能分析文件存储的默认文件路径

例如:

import megengine as mge
import megengine.module as M
from megengine.utils.profiler import Profiler

# With Learnable Parameters
for iter in range(0, 10):
    # Only profile record of last iter would be saved
    with Profiler("profile"):
        # your code here

# Then open the profile file in chrome timeline window

方法

__init__([path, format, topic, align_time, …])

初始化方法。

属性

ALL

CHROME_TIMELINE

COMMAND

OPERATOR

SCOPE

SYNC

TENSOR_LIFETIME

TENSOR_PROP