Skip to content

Commit f3d5923

Browse files
author
Yibing Liu
authored
Merge pull request #8116 from kuke/fix_profiler
Fix the error when sorted_key is none in profiler
2 parents 1d2dd9c + be65516 commit f3d5923

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

paddle/platform/profiler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
233233
};
234234
break;
235235
default:
236-
sorted_domain = "event end time";
236+
sorted_domain = "event first end time";
237237
}
238238

239239
std::vector<std::vector<EventItem>> events_table;

python/paddle/v2/fluid/profiler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ def profiler(state, sorted_key=None):
103103
core.enable_profiler(prof_state)
104104
yield
105105

106-
if sorted_key not in ['calls', 'total', 'max', 'min', 'ave']:
107-
raise ValueError("The state must be in 'calls', 'total', "
108-
"'max', 'min', 'ave'")
109106
sorted_key = 'default' if sorted_key is None else sorted_key
107+
if sorted_key not in ['default', 'calls', 'total', 'max', 'min', 'ave']:
108+
raise ValueError("The sorted_key must be None or in 'calls', 'total', "
109+
"'max', 'min' and 'ave'")
110110
key_map = {
111111
'default': core.EventSortingKey.kDefault,
112112
'calls': core.EventSortingKey.kCalls,

0 commit comments

Comments
 (0)