megengine.utils.profiler.Profiler

class Profiler(path='profile', format='chrome_timeline.json', formats=None, **kwargs)[源代码]

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

参数

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

实际案例

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

# With Learnable Parameters
profiler = Profiler()

for iter in range(0, 10):
# Only profile record of last iter would be saved

   with profiler:
      # your code here

# Then open the profile file in chrome timeline window

属性

CHROME_TIMELINE

directory

formats

path

valid_formats

valid_options

方法

dump()

format_path(path, pid, format)

start()

stop()