Skip to content

Commit 963e364

Browse files
committed
fix kenrel name apperance (PaddlePaddle#42071)
1 parent 9f3d938 commit 963e364

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

python/paddle/profiler/profiler_statistic.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
import collections
1515
from enum import Enum
16+
import re
1617

1718
from paddle.fluid.core import TracerEventType
1819

@@ -1317,10 +1318,11 @@ def format_ratio(ratio, indent=0):
13171318
append(header_sep)
13181319
append(row_format.format(*headers))
13191320
append(header_sep)
1321+
kernel_name_pattern = re.compile('(.+?)(<.*>)(\(.*\))')
13201322
for row_values in all_row_values:
1321-
indx = row_values[0].find('(')
1322-
if indx != -1:
1323-
name = row_values[0][:indx]
1323+
match = kernel_name_pattern.match(row_values[0])
1324+
if match:
1325+
name = match.group(1) + match.group(2)
13241326
else:
13251327
name = row_values[0]
13261328
if len(name) > name_column_width:

0 commit comments

Comments
 (0)