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

Pusing 4/20 fixed rutnime sources - more left

parent 83a52901
No related branches found
No related tags found
No related merge requests found
......@@ -16,11 +16,10 @@
#include <string.h>
std::vector<float> run_accuracies;
std::string model_params_path = "../../../build/model_params/";
std::string model_params_path = "../../test/dnn_benchmarks/model_params/";
// FIXIT: Move this to debug.h and include in all files
void dumpWeightsToFile(const char *file_name, void *weights_ptr) {
struct Tensor *weights = (Tensor *)weights_ptr;
// Move data back to host
hpvm_request_tensor(weights, 0);
......
......@@ -10,10 +10,9 @@ void testCifarNet() {
std::string dir_prefix =
model_params_path + std::string("/alexnet2_cifar10/");
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");
std::string input_path = dir_prefix + std::string("test_input.bin");
std::string labels_path = dir_prefix + std::string("test_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);
......@@ -119,9 +118,9 @@ void testCifarNet() {
void *gemm1biasout = tensorHalfAdd(gemm1out, dense_1_b);
void *result = tensorSoftmax(gemm1biasout);
uint8_t *labels = readLabelsBatch(labels_path.c_str(), start, end);
uint32_t *labels = readLabelsBatch3(labels_path.c_str(), start, end);
float accuracy = computeAccuracy2(labels, batch_size, result);
float accuracy = computeAccuracy3(labels, result);
final_accuracy += accuracy;
freeBatchMemory();
......
......@@ -9,9 +9,8 @@ int main() {
std::string dir_prefix = model_params_path + std::string("/alexnet_cifar10/");
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");
std::string input_path = dir_prefix + std::string("test_input.bin");
std::string labels_path = dir_prefix + std::string("test_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, 64, 3, 11, 11);
......@@ -86,9 +85,9 @@ int main() {
void *var_23 = tensorHalfAdd(var_22, dense_1_b);
void *var_24 = tensorSoftmax(var_23);
uint8_t *labels = readLabelsBatch(labels_path.c_str(), start, end);
uint32_t *labels = readLabelsBatch3(labels_path.c_str(), start, end);
float accuracy = computeAccuracy2(labels, batch_size, var_24);
float accuracy = computeAccuracy3(labels, var_24);
final_accuracy += accuracy;
freeBatchMemory();
......
......@@ -8,11 +8,9 @@ void testCifarNet() {
printf("********* Alexnet2 CIFAR-10 DNN ********** \n");
std::string dir_prefix =
model_params_path + std::string("/alexnet2_cifar10/");
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");
std::string dir_prefix = model_params_path + std::string("/alexnet2_cifar10/");
std::string input_path = dir_prefix + std::string("test_input.bin");
std::string labels_path = dir_prefix + std::string("test_labels.bin");
std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
void *conv2d_1_w =
......@@ -62,8 +60,8 @@ void testCifarNet() {
startMemTracking();
int test_input_size = 2000;
int batch_size = 2000;
int test_input_size = 5000;
int batch_size = 1000;
int batch_count = test_input_size / batch_size;
float final_accuracy = 0.0;
......@@ -119,9 +117,9 @@ void testCifarNet() {
void *gemm1biasout = tensorAdd(gemm1out, dense_1_b);
void *result = tensorSoftmax(gemm1biasout);
uint8_t *labels = readLabelsBatch(labels_path.c_str(), start, end);
uint32_t *labels = readLabelsBatch3(labels_path.c_str(), start, end);
float accuracy = computeAccuracy2(labels, batch_size, result);
float accuracy = computeAccuracy3(labels, result);
final_accuracy += accuracy;
freeBatchMemory();
......
......@@ -9,9 +9,9 @@ int main() {
std::string dir_prefix = model_params_path + std::string("/alexnet_cifar10/");
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");
std::string input_path = dir_prefix + std::string("test_input.bin");
//std::string labels_path = dir_prefix + std::string("labels.bin");
std::string labels32_path = dir_prefix + std::string("test_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, 64, 3, 11, 11);
......@@ -86,9 +86,9 @@ int main() {
void *var_23 = tensorAdd(var_22, dense_1_b);
void *var_24 = tensorSoftmax(var_23);
uint8_t *labels = readLabelsBatch(labels_path.c_str(), start, end);
uint32_t *labels = readLabelsBatch3(labels32_path.c_str(), start, end);
float accuracy = computeAccuracy2(labels, batch_size, var_24);
float accuracy = computeAccuracy3(labels, var_24);
final_accuracy += accuracy;
freeBatchMemory();
......
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