From 80015c0667dbcfff2bfaaf28946abcb425244754 Mon Sep 17 00:00:00 2001 From: chenjian Date: Sat, 7 May 2022 19:08:29 +0800 Subject: [PATCH] put_record_event_in_python_on_timeline_python (#42555) * put_record_event_in_python_on_timeline_python * fix --- python/paddle/profiler/utils.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/python/paddle/profiler/utils.py b/python/paddle/profiler/utils.py index fba1aeabf28..fd75ab9550d 100644 --- a/python/paddle/profiler/utils.py +++ b/python/paddle/profiler/utils.py @@ -25,9 +25,9 @@ _has_optimizer_wrapped = False _AllowedEventTypeList = [ TracerEventType.Dataloader, TracerEventType.ProfileStep, - TracerEventType.UserDefined, TracerEventType.Forward, - TracerEventType.Backward, TracerEventType.Optimization, - TracerEventType.PythonOp, TracerEventType.PythonUserDefined + TracerEventType.Forward, TracerEventType.Backward, + TracerEventType.Optimization, TracerEventType.PythonOp, + TracerEventType.PythonUserDefined ] @@ -37,7 +37,7 @@ class RecordEvent(ContextDecorator): Args: name(str): Name of the record event - event_type(TracerEventType, optional): Optional, default value is TracerEventType.UserDefined. It is reserved for internal purpose, and it is better not to specify this parameter. + event_type(TracerEventType, optional): Optional, default value is TracerEventType.PythonUserDefined. It is reserved for internal purpose, and it is better not to specify this parameter. Examples: .. code-block:: python @@ -64,7 +64,7 @@ class RecordEvent(ContextDecorator): def __init__(self, name: str, - event_type: TracerEventType=TracerEventType.UserDefined): + event_type: TracerEventType=TracerEventType.PythonUserDefined): self.name = name self.event_type = event_type self.event = None @@ -101,8 +101,6 @@ class RecordEvent(ContextDecorator): can be recorded.".format(*_AllowedEventTypeList)) self.event = None else: - if self.event_type == TracerEventType.UserDefined: - self.event_type == TracerEventType.PythonUserDefined self.event = _RecordEvent(self.name, self.event_type) def end(self): -- GitLab