From 989c76eaa26e87ed2ff860fcc400d82abdbe8af8 Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu> Date: Thu, 2 Apr 2020 19:59:16 -0500 Subject: [PATCH] Adding Unit test for Sampling --- .../dnn_sources/src/test_ops.cc | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc index 12390b6a31..c0952440da 100644 --- a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc +++ b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc @@ -572,6 +572,35 @@ void testPerforation(){ +void testSampling(){ + + printf("***** Testing Perforation ***** \n\n"); + Tensor* input = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 1, 3, 4, 4); + fillTensorWithVal(input, 1); + //fillWithOnesAndTwos(input); + + Tensor* filter = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 1, 3, 3, 3); + fillTensorWithVal(filter, 1); + + float* host_ptr = (float*) ((struct Tensor*) input)->host_data; + //host_ptr[0] = 0; + //host_ptr[1] = 0; + //host_ptr[2] = 0; + //host_ptr[3] = 0; + //host_ptr[4] = 0; + //host_ptr[5] = 0; + //printTensorValues(input); + + void* res = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 2, 1); + + printTensorValues(res); + +} + + + + + int main(){ @@ -602,7 +631,11 @@ int main(){ //testSampleFilter(); - testPerforation(); + //--- testPerforation(); + + + testSampling(); + stopProfiling(); -- GitLab