未验证 提交 80015c06 编写于 作者: C chenjian 提交者: GitHub

put_record_event_in_python_on_timeline_python (#42555)

* put_record_event_in_python_on_timeline_python

* fix
上级 c1e45a11
...@@ -25,9 +25,9 @@ _has_optimizer_wrapped = False ...@@ -25,9 +25,9 @@ _has_optimizer_wrapped = False
_AllowedEventTypeList = [ _AllowedEventTypeList = [
TracerEventType.Dataloader, TracerEventType.ProfileStep, TracerEventType.Dataloader, TracerEventType.ProfileStep,
TracerEventType.UserDefined, TracerEventType.Forward, TracerEventType.Forward, TracerEventType.Backward,
TracerEventType.Backward, TracerEventType.Optimization, TracerEventType.Optimization, TracerEventType.PythonOp,
TracerEventType.PythonOp, TracerEventType.PythonUserDefined TracerEventType.PythonUserDefined
] ]
...@@ -37,7 +37,7 @@ class RecordEvent(ContextDecorator): ...@@ -37,7 +37,7 @@ class RecordEvent(ContextDecorator):
Args: Args:
name(str): Name of the record event 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: Examples:
.. code-block:: python .. code-block:: python
...@@ -64,7 +64,7 @@ class RecordEvent(ContextDecorator): ...@@ -64,7 +64,7 @@ class RecordEvent(ContextDecorator):
def __init__(self, def __init__(self,
name: str, name: str,
event_type: TracerEventType=TracerEventType.UserDefined): event_type: TracerEventType=TracerEventType.PythonUserDefined):
self.name = name self.name = name
self.event_type = event_type self.event_type = event_type
self.event = None self.event = None
...@@ -101,8 +101,6 @@ class RecordEvent(ContextDecorator): ...@@ -101,8 +101,6 @@ class RecordEvent(ContextDecorator):
can be recorded.".format(*_AllowedEventTypeList)) can be recorded.".format(*_AllowedEventTypeList))
self.event = None self.event = None
else: else:
if self.event_type == TracerEventType.UserDefined:
self.event_type == TracerEventType.PythonUserDefined
self.event = _RecordEvent(self.name, self.event_type) self.event = _RecordEvent(self.name, self.event_type)
def end(self): def end(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册