Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cherry-pick] put_record_event_in_python_on_timeline_python (#42555) #42790

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions python/paddle/profiler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

_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
]


Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -101,8 +101,6 @@ def begin(self):
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):
Expand Down