Browse Source

UI fix bug of debugger page

tags/v1.1.0
WeiFeng-mindinsight 5 years ago
parent
commit
f88310271c
7 changed files with 73 additions and 34 deletions
  1. +29
    -4
      mindinsight/ui/src/components/debugger-grid-table-simple.vue
  2. +16
    -19
      mindinsight/ui/src/components/debugger-tensor.vue
  3. +3
    -0
      mindinsight/ui/src/components/header.vue
  4. +5
    -1
      mindinsight/ui/src/locales/en-us.json
  5. +7
    -3
      mindinsight/ui/src/locales/zh-cn.json
  6. +11
    -5
      mindinsight/ui/src/mixins/debugger-mixin.vue
  7. +2
    -2
      mindinsight/ui/src/views/debugger/debugger.vue

+ 29
- 4
mindinsight/ui/src/components/debugger-grid-table-simple.vue View File

@@ -64,6 +64,14 @@ limitations under the License.
<span>{{ $t('tensors.dimension') }} {{ shape }}</span> <span>{{ $t('tensors.dimension') }} {{ shape }}</span>
</div> </div>
<div class="accuracy-container"> <div class="accuracy-container">
{{$t('components.category')}}<el-select v-model="category"
class="select-category"
@change="accuracyChange">
<el-option v-for="item in categoryArr"
:key="item.label"
:label="item.label"
:value="item.value"></el-option>
</el-select>
{{$t('components.gridAccuracy')}}<el-select v-model="accuracy" {{$t('components.gridAccuracy')}}<el-select v-model="accuracy"
class="select-item" class="select-item"
@change="accuracyChange"> @change="accuracyChange">
@@ -162,6 +170,11 @@ export default {
colStartIndex: 0, colStartIndex: 0,
}, },
shape: '', shape: '',
categoryArr: [
{label: this.$t('components.value'), value: 'value'},
{label: this.$t('components.ScientificCounting'), value: 'science'},
],
category: 'value', // value:Numerical notation science:Scientific notation
}; };
}, },
computed: {}, computed: {},
@@ -239,7 +252,7 @@ export default {
id: -1, id: -1,
name: ' ', name: ' ',
field: -1, field: -1,
width: 100,
width: 120,
headerCssClass: 'headerStyle', headerCssClass: 'headerStyle',
}, },
]; ];
@@ -251,7 +264,7 @@ export default {
id: order, id: order,
name: order, name: order,
field: order, field: order,
width: 100,
width: 120,
headerCssClass: 'headerStyle', headerCssClass: 'headerStyle',
formatter: formatter:
this.gridType === this.gridTypeKeys.compare ? this.formateCompareColor : this.formateValueColor, this.gridType === this.gridTypeKeys.compare ? this.formateCompareColor : this.formateValueColor,
@@ -350,7 +363,11 @@ export default {
if (isNaN(innerValue) || innerValue === 'Infinity' || innerValue === '-Infinity') { if (isNaN(innerValue) || innerValue === 'Infinity' || innerValue === '-Infinity') {
tempArr.push(innerValue); tempArr.push(innerValue);
} else { } else {
tempArr.push(innerValue.toFixed(this.accuracy));
if (this.category === 'science') {
tempArr.push(innerValue.toExponential(this.accuracy));
} else {
tempArr.push(innerValue.toFixed(this.accuracy));
}
} }
}); });
tempData[innerOrder] = tempArr; tempData[innerOrder] = tempArr;
@@ -367,7 +384,11 @@ export default {
if (isNaN(innerData) || innerData === 'Infinity' || innerData === '-Infinity') { if (isNaN(innerData) || innerData === 'Infinity' || innerData === '-Infinity') {
tempData[innerOrder] = innerData; tempData[innerOrder] = innerData;
} else { } else {
tempData[innerOrder] = innerData.toFixed(this.accuracy);
if (this.category === 'science') {
tempData[innerOrder] = innerData.toExponential(this.accuracy);
} else {
tempData[innerOrder] = innerData.toFixed(this.accuracy);
}
} }
}); });
tempArr.push(tempData); tempArr.push(tempData);
@@ -676,6 +697,10 @@ export default {
width: 65px; width: 65px;
margin-left: 5px; margin-left: 5px;
} }
.select-category {
width: 105px;
margin-left: 5px;
}
} }
} }
} }


+ 16
- 19
mindinsight/ui/src/components/debugger-tensor.vue View File

@@ -279,12 +279,13 @@ export default {
tuningAdvice: [], tuningAdvice: [],
tuningAdviceTitle: '', tuningAdviceTitle: '',
watchPoints: [], watchPoints: [],
callbackFun: null,
}; };
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
window.addEventListener('resize', this.debounce(this.resizeCallback, 200), false);
this.callbackFun = this.debounce(this.resizeCallback, 200);
window.addEventListener('resize', this.callbackFun);
this.init(); this.init();
}); });
}, },
@@ -369,7 +370,7 @@ export default {
item.tuningAdvice = this.$t(`debugger.tensorTuningAdvice`)[tuning][2]; item.tuningAdvice = this.$t(`debugger.tensorTuningAdvice`)[tuning][2];
} }
item.params.forEach((element) => { item.params.forEach((element) => {
if (!element.actual_value) {
if (element.actual_value === undefined || element.actual_value === null) {
element.actual = this.$t('symbols.rightbracket'); element.actual = this.$t('symbols.rightbracket');
} else { } else {
element.actual = `, ${this.$t('debugger.actualValue')}${this.$t('symbols.colon')}${ element.actual = `, ${this.$t('debugger.actualValue')}${this.$t('symbols.colon')}${
@@ -397,22 +398,18 @@ export default {
if (item.params.length) { if (item.params.length) {
item.params.forEach((i, ind) => { item.params.forEach((i, ind) => {
const name = this.$parent.transCondition(i.name); const name = this.$parent.transCondition(i.name);
const actual =
i.actual_value === undefined || i.actual_value === null
? ''
: `, ${this.$t('debugger.actualValue')}:${i.actual_value}`;
if (!ind) { if (!ind) {
param += !i.actual_value
? `${name}${this.$t('symbols.leftbracket')}${this.$t('debugger.setValue')}:${i.value}${this.$t(
'symbols.rightbracket',
)}`
: `${name}${this.$t('symbols.leftbracket')}${this.$t('debugger.setValue')}:${i.value}, ${this.$t(
'debugger.actualValue',
)}:${i.actual_value}${this.$t('symbols.rightbracket')}`;
param += `${name}${this.$t('symbols.leftbracket')}${this.$t('debugger.setValue')}:${
i.value
}${actual}${this.$t('symbols.rightbracket')}`;
} else { } else {
param += !i.actual_value
? `, ${name}${this.$t('symbols.leftbracket')}${this.$t('debugger.setValue')}:${i.value}${this.$t(
'symbols.rightbracket',
)}`
: `, ${name}${this.$t('symbols.leftbracket')}${this.$t('debugger.setValue')}:${i.value}, ${this.$t(
'debugger.actualValue',
)}:${i.actual_value}${this.$t('symbols.rightbracket')}`;
param += `, ${name}${this.$t('symbols.leftbracket')}${this.$t('debugger.setValue')}:${
i.value
}${actual}${this.$t('symbols.rightbracket')}`;
} }
}); });
param = `(${param})`; param = `(${param})`;
@@ -1017,7 +1014,7 @@ export default {
}, },
}, },
destroyed() { destroyed() {
window.removeEventListener('resize', this.debounce(this.resizeCallback, 200), false);
window.removeEventListener('resize', this.callbackFun);
}, },
}; };
</script> </script>
@@ -1207,7 +1204,7 @@ export default {
} }
label { label {
display: inline-block; display: inline-block;
min-width: 100px;
min-width: 123px;
span { span {
border-left: none; border-left: none;
} }


+ 3
- 0
mindinsight/ui/src/components/header.vue View File

@@ -191,6 +191,9 @@ export default {
getActive() { getActive() {
const str = this.$route.path.split('/'); const str = this.$route.path.split('/');
if (str.length > 1) { if (str.length > 1) {
if (!str[1]) {
return;
}
if (str[1] === 'debugger') { if (str[1] === 'debugger') {
return this.$route.path; return this.$route.path;
} else if (str[1] === 'explain') { } else if (str[1] === 'explain') {


+ 5
- 1
mindinsight/ui/src/locales/en-us.json View File

@@ -465,7 +465,9 @@
"gridTableNoData": "No data in the table.", "gridTableNoData": "No data in the table.",
"value": "Value", "value": "Value",
"dimsFilterInputTitle": "Dimension Selection", "dimsFilterInputTitle": "Dimension Selection",
"dimsFilterInputTip": "The dimension value can be a specific index (consistent with the Python index meaning and supporting negative signs) or a colon (:) that indicates all values of the current dimension."
"dimsFilterInputTip": "The dimension value can be a specific index (consistent with the Python index meaning and supporting negative signs) or a colon (:) that indicates all values of the current dimension.",
"category": "Type",
"ScientificCounting": "Scientific notation"
}, },
"debugger": { "debugger": {
"debugger": "Debugger", "debugger": "Debugger",
@@ -581,6 +583,8 @@
"rtol": "Relative tolerance", "rtol": "Relative tolerance",
"abs_update_ratio_mean_gt": "Average of the absolute value of the change ratio >", "abs_update_ratio_mean_gt": "Average of the absolute value of the change ratio >",
"abs_update_ratio_mean_lt": "Average of the absolute value of the change ratio <", "abs_update_ratio_mean_lt": "Average of the absolute value of the change ratio <",
"abs_mean_update_ratio_gt": "Ratio of mean update >",
"abs_mean_update_ratio_lt": "Ratio of mean update <",
"param": "Threshold", "param": "Threshold",
"max_min_lt": "MAX-MIN <", "max_min_lt": "MAX-MIN <",
"max_min_gt": "MAX-MIN >", "max_min_gt": "MAX-MIN >",


+ 7
- 3
mindinsight/ui/src/locales/zh-cn.json View File

@@ -464,7 +464,9 @@
"gridTableNoData": "表格无数据", "gridTableNoData": "表格无数据",
"value": "数值", "value": "数值",
"dimsFilterInputTitle": "维度选择", "dimsFilterInputTitle": "维度选择",
"dimsFilterInputTip": "维度输入值可以是具体的索引(和Python的索引含义一致,支持负号)或者冒号\":\",其中冒号\":\"表示当前维度的所有值"
"dimsFilterInputTip": "维度输入值可以是具体的索引(和Python的索引含义一致,支持负号)或者冒号\":\",其中冒号\":\"表示当前维度的所有值",
"category": "分类",
"ScientificCounting": "科学计数"
}, },
"debugger": { "debugger": {
"debugger": "调试器", "debugger": "调试器",
@@ -580,9 +582,11 @@
"rtol": "相对容忍度", "rtol": "相对容忍度",
"abs_update_ratio_mean_gt": "变化比例绝对值的平均值>", "abs_update_ratio_mean_gt": "变化比例绝对值的平均值>",
"abs_update_ratio_mean_lt": "变化比例绝对值的平均值<", "abs_update_ratio_mean_lt": "变化比例绝对值的平均值<",
"abs_mean_update_ratio_gt": "平均变化比例值>",
"abs_mean_update_ratio_lt": "平均变化比例值<",
"param": "阈值", "param": "阈值",
"max_min_lt": "MAX-MIN<",
"max_min_gt": "MAX-MIN>"
"max_min_lt": "MAX-MIN <",
"max_min_gt": "MAX-MIN >"
}, },
"tensorTuningAdvice": { "tensorTuningAdvice": {
"operator_real_data_validation": [ "operator_real_data_validation": [


+ 11
- 5
mindinsight/ui/src/mixins/debugger-mixin.vue View File

@@ -300,8 +300,12 @@ export default {
this.querySingleNode({}, data.name, true); this.querySingleNode({}, data.name, true);
} else { } else {
if (this.graphFiles.value === this.$t('debugger.all')) { if (this.graphFiles.value === this.$t('debugger.all')) {
const graphName = data.name.split('/')[0];
this.queryAllTreeData(data.name.replace(`${graphName}/`, ''), true, graphName);
if (data.name.includes('/')) {
const graphName = data.name.split('/')[0];
this.queryAllTreeData(data.name.replace(`${graphName}/`, ''), true, graphName);
} else {
this.queryAllTreeData(data.name, true, data.name);
}
} else { } else {
this.queryAllTreeData(data.name, true, this.graphFiles.value); this.queryAllTreeData(data.name, true, this.graphFiles.value);
} }
@@ -1463,7 +1467,7 @@ export default {
item += ` ${this.transCondition(j.watch_condition.id)}`; item += ` ${this.transCondition(j.watch_condition.id)}`;
const param = (j.watch_condition.params || []) const param = (j.watch_condition.params || [])
.map((k) => .map((k) =>
!k.actual_value
k.actual_value === undefined || k.actual_value === null
? `${this.transCondition(k.name)}: ${this.$t('debugger.setValue')}:${k.value}` ? `${this.transCondition(k.name)}: ${this.$t('debugger.setValue')}:${k.value}`
: `${this.transCondition(k.name)}: ${this.$t('debugger.setValue')}:${k.value}, ${this.$t( : `${this.transCondition(k.name)}: ${this.$t('debugger.setValue')}:${k.value}, ${this.$t(
'debugger.actualValue', 'debugger.actualValue',
@@ -1591,8 +1595,10 @@ export default {
}, },
}; };
if (this.graphFiles.value === this.$t('debugger.all') && graphName && name) { if (this.graphFiles.value === this.$t('debugger.all') && graphName && name) {
name = `${graphName}/${name}`;
params.params.name = name;
if (name !== graphName) {
name = `${graphName}/${name}`;
params.params.name = name;
}
} else { } else {
params.params.graph_name = graphName; params.params.graph_name = graphName;
} }


+ 2
- 2
mindinsight/ui/src/views/debugger/debugger.vue View File

@@ -104,7 +104,7 @@ limitations under the License.
:show-checkbox="!!curWatchPointId"> :show-checkbox="!!curWatchPointId">
<span class="custom-tree-node" <span class="custom-tree-node"
slot-scope="{ node ,data }"> slot-scope="{ node ,data }">
<span :class="{const:data.type==='Const'}">
<span :class="{const:data.type==='Const' && curWatchPointId}">
<img v-if="data.type ==='name_scope'" <img v-if="data.type ==='name_scope'"
:src="require('@/assets/images/name-scope.svg')" :src="require('@/assets/images/name-scope.svg')"
class="image-type" /> class="image-type" />
@@ -134,7 +134,7 @@ limitations under the License.
ref="searchTree"> ref="searchTree">
<span class="custom-tree-node" <span class="custom-tree-node"
slot-scope="{ node ,data }"> slot-scope="{ node ,data }">
<span :class="{const:data.type==='Const'}">
<span :class="{const:data.type==='Const' && curWatchPointId}">
<img v-if="data.type ==='name_scope'" <img v-if="data.type ==='name_scope'"
:src="require('@/assets/images/name-scope.svg')" :src="require('@/assets/images/name-scope.svg')"
class="image-type" /> class="image-type" />


Loading…
Cancel
Save