提交 f288237d 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!363 fix the result of the number of decimal points of aicore type execution time

Merge pull request !363 from chenchao99/r0.5
......@@ -63,6 +63,17 @@ class AicoreTypeAnalyser(BaseAnalyser):
return self._default_filter(item, filter_condition)
self._result = list(filter(_inner_filter, self._data))
def _organize_query_result(self):
"""
Organize the query result.
Returns:
dict, the query result.
"""
for item in self._result:
item[1] = float(format(item[1], '.6f'))
return super()._organize_query_result()
def _convert_field_type(self, row):
"""
Convert the field type to the specific type.
......
......@@ -97,11 +97,7 @@ class BaseAnalyser(ABC):
self._sort(sort_condition)
if group_condition:
self._group(group_condition)
return {
'col_name': self._display_col_names,
'object': self._result,
'size': self._size
}
return self._organize_query_result()
@abstractmethod
def _load(self):
......@@ -244,3 +240,16 @@ class BaseAnalyser(ABC):
except ValidationError:
raise ProfilerPathErrorException('The profiling dir is invalid.')
return normalized_profiling_dir
def _organize_query_result(self):
"""
Organize the query result.
Returns:
dict, the query result.
"""
return {
'col_name': self._display_col_names,
'object': self._result,
'size': self._size
}
......@@ -126,34 +126,34 @@ class TestOpAnalyser:
expect_result = {
'col_name': ['op_type', 'execution_time', 'execution_frequency', 'percent'],
'object': [
['UnsortedSegmentSum', 44.60782642857142, 2, 35.28],
['GatherV2', 43.15544147619047, 2, 34.13],
['Slice', 20.376314999999998, 16, 16.12],
['Concat', 5.80845380952381, 4, 4.59],
['Split', 2.7142774761904764, 2, 2.15],
['MatMul', 1.9366814285714287, 15, 1.53],
['Mul', 1.9029486666666666, 32, 1.51],
['StridedSliceGrad', 1.5068342857142858, 2, 1.19],
['TransData', 1.1151575238095237, 30, 0.88],
['ReluGrad', 0.8540685714285714, 5, 0.68],
['Cast', 0.4846848571428572, 15, 0.38],
['ReLU', 0.48328214285714277, 5, 0.38],
['RealDiv', 0.4228071904761905, 15, 0.33],
['StridedSlice', 0.3455687619047618, 2, 0.27],
['Adam', 0.2859357142857143, 11, 0.23],
['BiasAdd', 0.18966285714285713, 5, 0.15],
['BiasAddGrad', 0.07168142857142856, 5, 0.06],
['Tile', 0.04415833333333334, 4, 0.03],
['ReduceSum', 0.030764857142857142, 5, 0.02],
['ApplyFtrl', 0.025453571428571426, 2, 0.02],
['AtomicAddrClean', 0.019368666666666666, 8, 0.02],
['AddN', 0.012836428571428572, 1, 0.01],
['Square', 0.009799333333333334, 1, 0.01],
['SigmoidCrossEntropyWithLogitsGrad', 0.009582142857142859, 2, 0.01],
['TensorAdd', 0.009218380952380952, 3, 0.01],
['SigmoidCrossEntropyWithLogits', 0.004808571428571428, 1, 0.0],
['ReduceMean', 0.004534999999999999, 1, 0.0],
['Assign', 0.0024766666666666665, 2, 0.0],
['UnsortedSegmentSum', 44.607826, 2, 35.28],
['GatherV2', 43.155441, 2, 34.13],
['Slice', 20.376315, 16, 16.12],
['Concat', 5.808454, 4, 4.59],
['Split', 2.714277, 2, 2.15],
['MatMul', 1.936681, 15, 1.53],
['Mul', 1.902949, 32, 1.51],
['StridedSliceGrad', 1.506834, 2, 1.19],
['TransData', 1.115158, 30, 0.88],
['ReluGrad', 0.854069, 5, 0.68],
['Cast', 0.484685, 15, 0.38],
['ReLU', 0.483282, 5, 0.38],
['RealDiv', 0.422807, 15, 0.33],
['StridedSlice', 0.345569, 2, 0.27],
['Adam', 0.285936, 11, 0.23],
['BiasAdd', 0.189663, 5, 0.15],
['BiasAddGrad', 0.071681, 5, 0.06],
['Tile', 0.044158, 4, 0.03],
['ReduceSum', 0.030765, 5, 0.02],
['ApplyFtrl', 0.025454, 2, 0.02],
['AtomicAddrClean', 0.019369, 8, 0.02],
['AddN', 0.012836, 1, 0.01],
['Square', 0.009799, 1, 0.01],
['SigmoidCrossEntropyWithLogitsGrad', 0.009582, 2, 0.01],
['TensorAdd', 0.009218, 3, 0.01],
['SigmoidCrossEntropyWithLogits', 0.004809, 1, 0.0],
['ReduceMean', 0.004535, 1, 0.0],
['Assign', 0.002477, 2, 0.0],
['AssignAdd', 0.001688, 1, 0.0]
],
'size': 29
......@@ -178,8 +178,8 @@ class TestOpAnalyser:
expect_result = {
'col_name': ['op_type', 'execution_time', 'execution_frequency', 'percent'],
'object': [
['MatMul', 1.9366814285714287, 15, 1.53],
['Mul', 1.9029486666666666, 32, 1.51]
['MatMul', 1.936681, 15, 1.53],
['Mul', 1.902949, 32, 1.51]
],
'size': 2
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册