Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
91b43051
"test/gemm/gemm_xdl_int8.cpp" did not exist on "5b178874a1b2a1cae217e87e1988ab92a40d71b8"
Unverified
Commit
91b43051
authored
Feb 17, 2020
by
Lijiao
Committed by
GitHub
Feb 17, 2020
Browse files
Update WebUI for metrics data changing to json string (#2067)
parent
43de0118
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
src/webui/src/static/function.ts
src/webui/src/static/function.ts
+10
-10
No files found.
src/webui/src/static/function.ts
View file @
91b43051
...
@@ -37,13 +37,21 @@ const convertDuration = (num: number): string => {
...
@@ -37,13 +37,21 @@ const convertDuration = (num: number): string => {
return
result
.
join
(
'
'
);
return
result
.
join
(
'
'
);
};
};
function
parseMetrics
(
metricData
:
string
):
any
{
if
(
metricData
.
includes
(
'
NaN
'
))
{
return
JSON5
.
parse
(
JSON5
.
parse
(
metricData
));
}
else
{
return
JSON
.
parse
(
JSON
.
parse
(
metricData
));
}
}
// get final result value
// get final result value
// draw Accuracy point graph
// draw Accuracy point graph
const
getFinalResult
=
(
final
?:
MetricDataRecord
[]):
number
=>
{
const
getFinalResult
=
(
final
?:
MetricDataRecord
[]):
number
=>
{
let
acc
;
let
acc
;
let
showDefault
=
0
;
let
showDefault
=
0
;
if
(
final
)
{
if
(
final
)
{
acc
=
JSON
.
parse
(
final
[
final
.
length
-
1
].
data
);
acc
=
parse
Metrics
(
final
[
final
.
length
-
1
].
data
);
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
acc
.
default
)
{
if
(
acc
.
default
)
{
showDefault
=
acc
.
default
;
showDefault
=
acc
.
default
;
...
@@ -61,7 +69,7 @@ const getFinalResult = (final?: MetricDataRecord[]): number => {
...
@@ -61,7 +69,7 @@ const getFinalResult = (final?: MetricDataRecord[]): number => {
const
getFinal
=
(
final
?:
MetricDataRecord
[]):
FinalType
|
undefined
=>
{
const
getFinal
=
(
final
?:
MetricDataRecord
[]):
FinalType
|
undefined
=>
{
let
showDefault
:
FinalType
;
let
showDefault
:
FinalType
;
if
(
final
)
{
if
(
final
)
{
showDefault
=
JSON
.
parse
(
final
[
final
.
length
-
1
].
data
);
showDefault
=
parse
Metrics
(
final
[
final
.
length
-
1
].
data
);
if
(
typeof
showDefault
===
'
number
'
)
{
if
(
typeof
showDefault
===
'
number
'
)
{
showDefault
=
{
default
:
showDefault
};
showDefault
=
{
default
:
showDefault
};
}
}
...
@@ -179,14 +187,6 @@ function formatTimestamp(timestamp?: number, placeholder?: string): string {
...
@@ -179,14 +187,6 @@ function formatTimestamp(timestamp?: number, placeholder?: string): string {
return
timestamp
?
new
Date
(
timestamp
).
toLocaleString
(
'
en-US
'
)
:
placeholder
;
return
timestamp
?
new
Date
(
timestamp
).
toLocaleString
(
'
en-US
'
)
:
placeholder
;
}
}
function
parseMetrics
(
metricData
:
string
):
any
{
if
(
metricData
.
includes
(
'
NaN
'
))
{
return
JSON5
.
parse
(
metricData
)
}
else
{
return
JSON
.
parse
(
metricData
)
}
}
function
metricAccuracy
(
metric
:
MetricDataRecord
):
number
{
function
metricAccuracy
(
metric
:
MetricDataRecord
):
number
{
const
data
=
parseMetrics
(
metric
.
data
);
const
data
=
parseMetrics
(
metric
.
data
);
return
typeof
data
===
'
number
'
?
data
:
NaN
;
return
typeof
data
===
'
number
'
?
data
:
NaN
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment