diff --git a/llvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h b/llvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h index 750891d138f1506d9ad557adc9a440708f8382b4..6cf1cc90f4f3003efc939879c9679fb3dea3e2c6 100644 --- a/llvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h +++ b/llvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h @@ -225,14 +225,16 @@ void* readInputTensor(const char* file_name, int data_type, int dim1_size, int d struct Tensor* readTrainedWeights(const char* file_name, int data_type, - int dim1_size, int dim2_size, - int dim3_size, int dim4_size){ + long int dim1_size, long int dim2_size, + long int dim3_size, long int dim4_size){ // FIXIT: Don't assume floating point types int type_size = 4; // NOTE: Assuming floating point tensors long int num_elems = dim1_size * dim2_size * dim3_size * dim4_size; long int size_in_bytes = type_size * dim1_size * dim2_size * dim3_size * dim4_size; float* tensor_data = (float*) malloc(sizeof(float) * num_elems); + printf("size_in_bytes = %lu \n", size_in_bytes); + int file_header_size = 0; FILE* file = fopen(file_name, "rb"); @@ -578,5 +580,12 @@ float computePSNRViolation(void* gold_ptr, void* approx_ptr, float PSNR_threshol } +void dumpOutput(void* output){ + + + +} + + #endif diff --git a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/pipeline.cc b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/pipeline.cc index c87ff87962bb0e5a3bfd34116f528ca4fb2ded80..0c74f130144488ce3901d450b24a234aefb1209c 100644 --- a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/pipeline.cc +++ b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/pipeline.cc @@ -26,16 +26,17 @@ void testLenetTanh(){ printf("********* Pipeline: Gaussian - Outline - Motion Blur - Emboss ********** \n"); // FIXIT: Extend this to batch of images - currently 5 images - int test_batch_size = 9145; - int H = 240; - int W = 300; + //long int test_batch_size = 9145; + long int test_batch_size = 2000; + long int H = 240; + long int W = 300; printf("Reading input\n"); - void* input = readTrainedWeights("../pipeline/dataset/caltech101_255_float32.bin", + void* input = readTrainedWeights("../model_params/pipeline/dataset/caltech101_255_float32.bin", float_type, test_batch_size, 1, H, W); printf("Reading golden output\n"); - void* golden_output = readTrainedWeights("../pipeline/golden_output/caltech-gaussian-outline-motionblur-emboss.bin", + void* golden_output = readTrainedWeights("../model_params/pipeline/golden_output/caltech-gaussian-outline-motionblur-emboss.bin", float_type, test_batch_size, 1, H, W); @@ -43,19 +44,19 @@ void testLenetTanh(){ // NOTE: Filter descriptors do NOT have batch size // NOTE: First two dims are output channels (configurable), input channels (MUST match input channels) // IMP: The output channels matches the trained model - not the Lenet arch proposed in Andrew Ng's class - void* gaussian_filter = readTrainedWeights("../pipeline/filters/GaussianFilter.bin", + void* gaussian_filter = readTrainedWeights("../model_params/pipeline/filters/GaussianFilter.bin", float_type, 1, 1, 9, 9); - void* outline_filter = readTrainedWeights("../pipeline/filters/OutlineFilter.bin", + void* outline_filter = readTrainedWeights("../model_params/pipeline/filters/OutlineFilter.bin", float_type, 1, 1, 3, 3); - void* sharpen_filter = readTrainedWeights("../pipeline/filters/SharpenFilter.bin", + void* sharpen_filter = readTrainedWeights("../model_params/pipeline/filters/SharpenFilter.bin", float_type, 1, 1, 3, 3); - void* motionblur_filter = readTrainedWeights("../pipeline/filters/MotionblurFilter.bin", + void* motionblur_filter = readTrainedWeights("../model_params/pipeline/filters/MotionblurFilter.bin", float_type, 1, 1, 9, 9); //void* conv1_bias = readTrainedWeights("../model_params/lenet_keras/conv1_bias.bin", //float_type, 1, 32, 1, 1); - void* emboss_filter = readTrainedWeights("../pipeline/filters/EmbossFilter.bin", + void* emboss_filter = readTrainedWeights("../model_params/pipeline/filters/EmbossFilter.bin", float_type, 1, 1, 5, 5); - void* emboss_bias = readTrainedWeights("../pipeline/filters/EmbossBias.bin", + void* emboss_bias = readTrainedWeights("../model_params/pipeline/filters/EmbossBias.bin", float_type, 1, 1, 1, 1); clearTensorMap();