Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
ab7f11cd
Commit
ab7f11cd
authored
5 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Adding confidence dumping to AlexNet2
parent
5ea062d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/projects/hpvm-tensor-rt/dnn_sources/src/promise/alexnet2_promise.cc
+36
-6
36 additions, 6 deletions
...pvm-tensor-rt/dnn_sources/src/promise/alexnet2_promise.cc
with
36 additions
and
6 deletions
llvm/projects/hpvm-tensor-rt/dnn_sources/src/promise/alexnet2_promise.cc
+
36
−
6
View file @
ab7f11cd
...
...
@@ -6,8 +6,8 @@
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<string.h>
#include
"
../../../tensor_runtime/include/
tensor_runtime.h"
#include
"
../../include/
utils.h"
#include
"tensor_runtime.h"
#include
"utils.h"
int
total_runs
=
1
;
...
...
@@ -40,6 +40,15 @@ int main(int argc, char* argv[]){
offset
=
atoi
(
argv
[
5
]);
}
bool
shouldDumpClassConf
=
false
;
float
*
classConfs
;
int
*
predictedLabels
;
if
(
argc
>
6
){
shouldDumpClassConf
=
true
;
classConfs
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
test_input_size
);
predictedLabels
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
test_input_size
);
}
llvm_hpvm_initTensorRt
(
1
);
...
...
@@ -56,11 +65,15 @@ int main(int argc, char* argv[]){
int
batch_count
=
test_input_size
/
batch_size
;
float
final_accuracy
=
0.0
;
std
::
string
dir_prefix
=
std
::
string
(
"../model_params/alexnet2_cifar10_test/"
);
std
::
string
input_path
=
dir_prefix
+
std
::
string
(
"input.bin"
);
std
::
string
labels_path
=
dir_prefix
+
std
::
string
(
"labels.bin"
);
std
::
string
labels32_path
=
dir_prefix
+
std
::
string
(
"labels32.bin"
);
for
(
int
i
=
0
;
i
<
batch_count
;
i
++
){
std
::
string
dir_prefix
=
std
::
string
(
"../model_params/alexnet2_cifar10_test/"
);
std
::
string
input_path
=
dir_prefix
+
std
::
string
(
"input.bin"
);
std
::
string
labels_path
=
dir_prefix
+
std
::
string
(
"labels.bin"
);
std
::
string
conv2d_1_w_path
=
dir_prefix
+
std
::
string
(
"conv2d_1_w.bin"
);
void
*
conv2d_1_w
=
readTrainedWeights
(
conv2d_1_w_path
.
c_str
(),
0
,
32
,
3
,
3
,
3
);
std
::
string
conv2d_1_b_path
=
dir_prefix
+
std
::
string
(
"conv2d_1_b.bin"
);
...
...
@@ -110,7 +123,15 @@ int main(int argc, char* argv[]){
uint8_t
*
labels
=
readLabelsBatch
(
labels_path
.
c_str
(),
start
,
end
);
float
accuracy
=
computeAccuracy2
(
labels
,
batch_size
,
var_7
);
final_accuracy
+=
accuracy
;
final_accuracy
+=
accuracy
;
if
(
shouldDumpClassConf
){
int
relative_start
=
start
-
offset
;
int
relative_end
=
end
-
offset
;
copyClassConfsAndLabels
(
var_6
,
classConfs
,
predictedLabels
,
relative_start
,
relative_end
);
}
freeBatchMemory
();
}
...
...
@@ -120,6 +141,15 @@ int main(int argc, char* argv[]){
if
(
final_accuracy
<
bench_acc
)
missed
+=
1
;
if
(
shouldDumpClassConf
){
int
labels_start
=
offset
;
int
labels_end
=
offset
+
test_input_size
;
uint32_t
*
goldLabels
=
readLabelsBatch3
(
labels32_path
.
c_str
(),
labels_start
,
labels_end
);
dumpClassConfsAndLabels
(
classConfs
,
predictedLabels
,
goldLabels
,
test_input_size
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment