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

Adding unit tests for sampling and baseline for 1*1 filter

parent ebd599c0
No related branches found
No related tags found
No related merge requests found
...@@ -659,16 +659,72 @@ void testSampling2(){ ...@@ -659,16 +659,72 @@ void testSampling2(){
printTensorValues(res); printTensorValues(res);
fillTensorWithVal(filter, 2);
// Start from offset 1 completely failing // Start from offset 1 completely failing
void* res2 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 2, 0); void* res2 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 2, 0);
printTensorValues(res2); printTensorValues(res2);
fillTensorWithVal(filter, 2);
// NOTE -- even after reinitializing --- error remains - this is indicative of input corruption
// Results are strange. Are filters being overwritten? // Results are strange. Are filters being overwritten?
void* res3 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 2, 1); void* res3 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
printTensorValues(res3);
}
void testSampling3(){
printf("***** TestingSampling3 ***** \n\n");
Tensor* input = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 1, 9, 2, 2);
fillTensorWithVal(input, 2);
//fillWithOnesAndTwos(input);
Tensor* filter = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 4, 9, 1, 1);
fillTensorWithVal(filter, 2);
// BASELINE : expected result -- 36, 36, 36, ...
void* res1 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
printTensorValues(res1);
printf ("\n");
// BASELINE: expected result - 32, 32, 32,
void* res2 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 2, 0);
printTensorValues(res2);
printf ("\n");
void* res3 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 3, 0);
printTensorValues(res3); printTensorValues(res3);
printf ("\n");
void* res4 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 3, 1);
printTensorValues(res4);
printf ("\n");
void* res5 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 4, 0);
printTensorValues(res5);
printf ("\n");
void* res6 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 4, 1);
printTensorValues(res6);
printf ("\n");
} }
...@@ -708,7 +764,7 @@ int main(){ ...@@ -708,7 +764,7 @@ int main(){
//testSampleFilter(); //testSampleFilter();
//testPerforation(); testPerforation();
// testPerforation2(); // testPerforation2();
...@@ -719,6 +775,9 @@ int main(){ ...@@ -719,6 +775,9 @@ int main(){
testSampling2(); testSampling2();
testSampling3();
stopProfiling(); stopProfiling();
......
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