diff --git a/hpvm/test/dnn_benchmarks/hpvm-c/benchmarks/lenet_mnist/lenet_mnist.cpp b/hpvm/test/dnn_benchmarks/hpvm-c/benchmarks/lenet_mnist/lenet_mnist.cpp index 684c1bfef532c162a7981a12b54b5282c5a1b114..ed681f24890011b8c10a645b58d48cca838e2795 100644 --- a/hpvm/test/dnn_benchmarks/hpvm-c/benchmarks/lenet_mnist/lenet_mnist.cpp +++ b/hpvm/test/dnn_benchmarks/hpvm-c/benchmarks/lenet_mnist/lenet_mnist.cpp @@ -1,7 +1,8 @@ + #include <string> #include <hpvm.h> #include <tensorUtils.h> -#include <config.h> +#include <iostream> #ifndef MODEL_PARAMS_DIR #error MODEL_PARAMS_DIR is not defined @@ -292,29 +293,45 @@ int main(int argc, char *argv[]) { std::string dir_prefix = std::string(MODEL_PARAMS_DIR_STR) + "/lenet_mnist/"; 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"); + + //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, 1, 5, 5); - std::string conv2d_1_b_path = dir_prefix + std::string("conv2d_1_b.bin"); + readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/conv2d_1_w_fp16.bin", + 0, 32, 1, 5, 5); + + //std::string conv2d_1_b_path = dir_prefix + std::string("conv2d_1_b.bin"); void *conv2d_1_b = - readTrainedWeights(conv2d_1_b_path.c_str(), 0, 1, 32, 1, 1); - std::string conv2d_2_w_path = dir_prefix + std::string("conv2d_2_w.bin"); + readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/conv2d_1_b_fp16.bin", + 0, 1, 32, 1, 1); + + //std::string conv2d_2_w_path = dir_prefix + std::string("conv2d_2_w.bin"); void *conv2d_2_w = - readTrainedWeights(conv2d_2_w_path.c_str(), 0, 64, 32, 5, 5); - std::string conv2d_2_b_path = dir_prefix + std::string("conv2d_2_b.bin"); + readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/conv2d_2_w_fp16.bin", + 0, 64, 32, 5, 5); + + //std::string conv2d_2_b_path = dir_prefix + std::string("conv2d_2_b.bin"); void *conv2d_2_b = - readTrainedWeights(conv2d_2_b_path.c_str(), 0, 1, 64, 1, 1); - std::string dense_1_w_path = dir_prefix + std::string("dense_1_w.bin"); + readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/conv2d_2_b_fp16.bin", + 0, 1, 64, 1, 1); + + //std::string dense_1_w_path = dir_prefix + std::string("dense_1_w.bin"); void *dense_1_w = - readTrainedWeights(dense_1_w_path.c_str(), 0, 1, 1, 3136, 1024); - std::string dense_1_b_path = dir_prefix + std::string("dense_1_b.bin"); + readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/dense_1_w_fp16_transpose.bin", + 0, 1, 1, 3136, 1024); + + //std::string dense_1_b_path = dir_prefix + std::string("dense_1_b.bin"); void *dense_1_b = - readTrainedWeights(dense_1_b_path.c_str(), 0, 1, 1024, 1, 1); - std::string dense_2_w_path = dir_prefix + std::string("dense_2_w.bin"); + readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/dense_1_b_fp16.bin", + 0, 1, 1024, 1, 1); + + //std::string dense_2_w_path = dir_prefix + std::string("dense_2_w.bin"); void *dense_2_w = - readTrainedWeights(dense_2_w_path.c_str(), 0, 1, 1, 1024, 10); - std::string dense_2_b_path = dir_prefix + std::string("dense_2_b.bin"); - void *dense_2_b = readTrainedWeights(dense_2_b_path.c_str(), 0, 1, 10, 1, 1); + readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/dense_2_w_fp16_transpose.bin", + 0, 1, 1, 1024, 10); + + //std::string dense_2_b_path = dir_prefix + std::string("dense_2_b.bin"); + void *dense_2_b = readTrainedWeights(MODEL_PARAMS_DIR_STR "/lenet_mnist/dense_2_b_fp16.bin", + 0, 1, 10, 1, 1); RootIn *args = static_cast<RootIn *>(malloc(sizeof(RootIn))); void *input = create4DTensor(0, nchw, batch_size, 1, 28, 28);