Skip to content
Snippets Groups Projects
Commit 90b173dd authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Adding dumpExecutionAccuracies to DNN utils

parent 49a62c52
No related branches found
No related tags found
No related merge requests found
......@@ -5,10 +5,14 @@
#include <sstream>
#include <vector>
#include "../../tensor_runtime/include/tensor.h"
#include "types.h"
std::vector<float> run_accuracies;
void printTensorInfo(void* tensor_ptr){
struct Tensor* tensor = (struct Tensor*) tensor_ptr;
......@@ -433,6 +437,8 @@ float computeAccuracy2(uint8_t* labels, int num_labels, void* result_ptr, unsign
void dumpFinalAccuracy(float accuracy){
printf("\n\n **** Final Accuracy = %f \n", accuracy);
FILE* fp = fopen("final_accuracy", "w+");
if(fp != NULL){
std::ostringstream ss;
......@@ -443,6 +449,27 @@ void dumpFinalAccuracy(float accuracy){
}
fclose(fp);
run_accuracies.push_back(accuracy);
}
void dumpExecutionAccuracies(){
FILE* fp = fopen("run_accuracies.txt", "w+");
if(fp != NULL){
for (int i = 0; i < run_accuracies.size(); i++){
float accuracy = run_accuracies[i];
std::ostringstream ss;
ss << std::fixed << accuracy;
std::string print_str = ss.str();
fwrite(print_str.c_str(), 1, print_str.length(), fp);
fwrite("\n", 1, 1, fp);
}
}
fclose(fp);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment