jax.profiler.StepTraceAnnotation#
- class jax.profiler.StepTraceAnnotation(name, **kwargs)[source]#
上下文管理器,在 profiler 中生成步骤跟踪事件。
步骤跟踪事件跨越上下文所包含代码的持续时间。Profiler 将为每个步骤跟踪事件提供性能分析。
例如,它可以用于标记训练步骤,并使 profiler 能够提供每个步骤的性能分析
>>> while global_step < NUM_STEPS: ... with jax.profiler.StepTraceAnnotation("train", step_num=global_step): ... train_step() ... global_step += 1
如果事件发生在 TensorBoard 跟踪进程时,这将导致“train xx”事件显示在跟踪时间轴上。此外,如果使用加速器,设备跟踪时间轴也将显示“train xx”事件。请注意,“step_num”可以设置为关键字参数,以将全局步骤号传递给 profiler。
- 参数:
name (str)
方法
__init__
(self, arg0, /, **kwargs)属性
is_enabled
set_metadata