Commit 93c0807d by liyinqiao

Optimize the unit test.

1. Use the _CheckData with tolerance in unit test to avoid the bug in "0.0F != -0.0F" case.
2, Clean the codes.
parent dcd3a86b
......@@ -67,7 +67,9 @@ bool TestAbsolute1()
bUser = Absolute(*a);
/* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -89,7 +91,9 @@ bool TestAbsolute1()
bUserGPU = Absolute(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -93,7 +93,8 @@ bool TestConcatenate1()
tUser = Concatenate(*sList, 1);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -122,7 +123,8 @@ bool TestConcatenate1()
tUserGPU = Concatenate(*sList, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete sList;
......@@ -222,7 +224,8 @@ bool TestConcatenate2()
tUser = Concatenate(*sList, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -251,7 +254,8 @@ bool TestConcatenate2()
tUserGPU = Concatenate(*sList, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete sList;
......@@ -349,7 +353,8 @@ bool TestConcatenate3()
tUser = Concatenate(*sList, 1);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -378,7 +383,8 @@ bool TestConcatenate3()
tUserGPU = Concatenate(*sList, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete sList;
......@@ -469,7 +475,8 @@ bool TestConcatenate4()
tUser = Concatenate(*s1, *s2, 1);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -491,7 +498,8 @@ bool TestConcatenate4()
tUserGPU = Concatenate(*sGPU1, *sGPU2, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......
......@@ -92,7 +92,7 @@ bool TestConcatenateSolely1()
_ConcatenateSolely(sList, t, 1);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -119,7 +119,7 @@ bool TestConcatenateSolely1()
_ConcatenateSolely(sList, tGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete sList;
......@@ -217,7 +217,7 @@ bool TestConcatenateSolely2()
_ConcatenateSolely(sList, t, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -244,7 +244,7 @@ bool TestConcatenateSolely2()
_ConcatenateSolely(sList, tGPU, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete sList;
......@@ -340,7 +340,7 @@ bool TestConcatenateSolely3()
_ConcatenateSolely(sList, t, 1);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -367,7 +367,7 @@ bool TestConcatenateSolely3()
_ConcatenateSolely(sList, tGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete sList;
......
......@@ -64,7 +64,7 @@ bool TestConvertDataType1()
_ConvertDataType(a, b);
/* check results */
cpuTest = _CheckData(b, answer, aUnitNum);
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -81,7 +81,7 @@ bool TestConvertDataType1()
_ConvertDataType(aGPU, bGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum);
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -105,9 +105,9 @@ bool TestCopyIndexed1()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) &&
_CheckData(t2, answer, tUnitNum) &&
_CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -134,9 +134,9 @@ bool TestCopyIndexed1()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) &&
_CheckData(tGPU2, answer, tUnitNum) &&
_CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -250,9 +250,9 @@ bool TestCopyIndexed2()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex);
/* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) &&
_CheckData(t2, answer, tUnitNum) &&
_CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -279,9 +279,9 @@ bool TestCopyIndexed2()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) &&
_CheckData(tGPU2, answer, tUnitNum) &&
_CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -395,9 +395,9 @@ bool TestCopyIndexed3()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) &&
_CheckData(t2, answer, tUnitNum) &&
_CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -424,9 +424,9 @@ bool TestCopyIndexed3()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) &&
_CheckData(tGPU2, answer, tUnitNum) &&
_CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -540,9 +540,9 @@ bool TestCopyIndexed4()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) &&
_CheckData(t2, answer, tUnitNum) &&
_CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -569,9 +569,9 @@ bool TestCopyIndexed4()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) &&
_CheckData(tGPU2, answer, tUnitNum) &&
_CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -685,9 +685,9 @@ bool TestCopyIndexed5()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) &&
_CheckData(t2, answer, tUnitNum) &&
_CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -714,9 +714,9 @@ bool TestCopyIndexed5()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) &&
_CheckData(tGPU2, answer, tUnitNum) &&
_CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -835,8 +835,8 @@ bool TestCopyIndexed6()
_CopyIndexed(s, t2, dim, sIndex, tIndex, copyNum);
/* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) &&
_CheckData(t2, answer, tUnitNum);
cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -861,8 +861,8 @@ bool TestCopyIndexed6()
_CopyIndexed(sGPU, tGPU2, dim, sIndexGPU, tIndexGPU, copyNum);
/* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) &&
_CheckData(tGPU2, answer, tUnitNum);
gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -58,7 +58,8 @@ bool TestCopyValues1()
tUser = CopyValues(*s);
/* check results */
cpuTest = _CheckData(t, sData, sUnitNum) && _CheckData(&tUser, sData, sUnitNum);
cpuTest = _CheckData(t, sData, sUnitNum, 1e-4F) &&
_CheckData(&tUser, sData, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -78,7 +79,8 @@ bool TestCopyValues1()
tUserGPU = CopyValues(*sGPU);
/* check results */
gpuTest = _CheckData(tGPU, sData, sUnitNum) && _CheckData(&tUser, sData, sUnitNum);
gpuTest = _CheckData(tGPU, sData, sUnitNum, 1e-4F) &&
_CheckData(&tUser, sData, sUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -67,7 +67,9 @@ bool TestCos1()
bUser = Cos(*a);
/* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -89,7 +91,9 @@ bool TestCos1()
bUserGPU = Cos(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -81,9 +81,9 @@ bool TestDivDim1()
cUser = DivDim(*a, *b, 0);
/* check results */
cpuTest = _CheckData(c, answer, aUnitNum) &&
_CheckData(cMe, answer, aUnitNum) &&
_CheckData(&cUser, answer, aUnitNum);
cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -108,9 +108,9 @@ bool TestDivDim1()
cUserGPU = DivDim(*aGPU, *bGPU, 0);
/* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) &&
_CheckData(cMeGPU, answer, aUnitNum) &&
_CheckData(&cUserGPU, answer, aUnitNum);
gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -195,9 +195,9 @@ bool TestDivDim2()
cUser = DivDim(*a, *b, 1);
/* check results */
cpuTest = _CheckData(c, answer, aUnitNum) &&
_CheckData(cMe, answer, aUnitNum) &&
_CheckData(&cUser, answer, aUnitNum);
cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -222,9 +222,9 @@ bool TestDivDim2()
cUserGPU = DivDim(*aGPU, *bGPU, 1);
/* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) &&
_CheckData(cMeGPU, answer, aUnitNum) &&
_CheckData(&cUserGPU, answer, aUnitNum);
gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -90,8 +90,8 @@ bool TestGather1()
tUser = Gather(*s, *index);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) &&
_CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -113,8 +113,8 @@ bool TestGather1()
tUserGPU = Gather(*sGPU, *indexGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) &&
_CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -65,7 +65,8 @@ bool TestHardTanH1()
yUser = HardTanH(*x);
/* check results */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -85,7 +86,8 @@ bool TestHardTanH1()
yUserGPU = HardTanH(*xGPU);
/* check results */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......
......@@ -63,7 +63,8 @@ bool TestIdentity1()
yUser = Identity(*x);
/* check result */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -83,7 +84,8 @@ bool TestIdentity1()
yUserGPU = Identity(*xGPU);
/* check result */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......
......@@ -67,7 +67,9 @@ bool TestLog1()
bUser = Log(*a);
/* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -89,7 +91,9 @@ bool TestLog1()
bUserGPU = Log(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -63,7 +63,8 @@ bool TestLogSoftmax1()
yUser = LogSoftmax(*x, 1);
/* check result */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -83,7 +84,8 @@ bool TestLogSoftmax1()
yUserGPU = LogSoftmax(*xGPU, 1);
/* check result */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......@@ -150,8 +152,8 @@ bool TestLogSoftmax2()
_LogSoftmaxBackward(g, y, x, dedy, dedx, NULL, 1, CROSSENTROPY);
/* check result */
cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F)
&& _CheckData(dedx, dedxAnswer, unitNum, 1e-4F);
cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F) &&
_CheckData(dedx, dedxAnswer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -178,7 +180,8 @@ bool TestLogSoftmax2()
_LogSoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, CROSSENTROPY);
/* check result */
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) && _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) &&
_CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......@@ -282,8 +285,8 @@ bool TestLogSoftmax3()
_LogSoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, SQUAREDERROR);
/* check result */
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F)
&& _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-3F);
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) &&
_CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......
......@@ -88,7 +88,8 @@ bool TestMatrixMul1()
tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -110,7 +111,8 @@ bool TestMatrixMul1()
tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -202,7 +204,8 @@ bool TestMatrixMul2()
tUser = MatrixMul(*s1, X_TRANS, *s2, X_NOTRANS);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -224,7 +227,8 @@ bool TestMatrixMul2()
tUserGPU = MatrixMul(*sGPU1, X_TRANS, *sGPU2, X_NOTRANS);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -336,7 +340,8 @@ bool TestMatrixMul3()
tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -358,7 +363,8 @@ bool TestMatrixMul3()
tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -459,7 +465,8 @@ bool TestMatrixMul4()
tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -481,7 +488,8 @@ bool TestMatrixMul4()
tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......
......@@ -86,7 +86,7 @@ bool TestMatrixMul2D1()
_MatrixMul2D(s1, X_NOTRANS, s2, X_NOTRANS, t);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -106,7 +106,7 @@ bool TestMatrixMul2D1()
_MatrixMul2D(sGPU1, X_NOTRANS, sGPU2, X_NOTRANS, tGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -196,7 +196,7 @@ bool TestMatrixMul2D2()
_MatrixMul2D(s1, X_TRANS, s2, X_NOTRANS, t);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -216,7 +216,7 @@ bool TestMatrixMul2D2()
_MatrixMul2D(sGPU1, X_TRANS, sGPU2, X_NOTRANS, tGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......
......@@ -86,7 +86,7 @@ bool TestMatrixMul2DParallel1()
_MatrixMul2DParallel(s1, X_NOTRANS, s2, X_NOTRANS, t);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -162,7 +162,7 @@ bool TestMatrixMul2DParallel2()
_MatrixMul2DParallel(s1, X_TRANS, s2, X_NOTRANS, t);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......
......@@ -88,7 +88,8 @@ bool TestMatrixMulBatched1()
tUser = MatrixMulBatched(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -110,7 +111,8 @@ bool TestMatrixMulBatched1()
tUserGPU = MatrixMulBatched(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -210,7 +212,8 @@ bool TestMatrixMulBatched2()
tUser = MatrixMulBatched(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -232,7 +235,8 @@ bool TestMatrixMulBatched2()
tUserGPU = MatrixMulBatched(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......
......@@ -72,7 +72,8 @@ bool TestMerge1()
tUser = Merge(*s, 1, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -92,7 +93,8 @@ bool TestMerge1()
tUserGPU = Merge(*sGPU, 1, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -186,8 +188,10 @@ bool TestMerge2()
tUser2 = Merge(*s, 2, 0);
/* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1)
&& _CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2);
cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -212,8 +216,10 @@ bool TestMerge2()
tUserGPU2 = Merge(*sGPU, 2, 0);
/* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1)
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2);
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */
delete s;
......@@ -302,7 +308,8 @@ bool TestMerge3()
tUser = Merge(*smallList, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -331,7 +338,8 @@ bool TestMerge3()
tUserGPU = Merge(*smallList, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -418,7 +426,8 @@ bool TestMerge4()
tUser = Merge(*smallList, 1);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -447,7 +456,8 @@ bool TestMerge4()
tUserGPU = Merge(*smallList, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......
......@@ -90,9 +90,9 @@ bool TestMultiply1()
tUser = Multiply(*s1, *s2, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) &&
_CheckData(tMe, answer, tUnitNum) &&
_CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(tMe, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -117,9 +117,9 @@ bool TestMultiply1()
tUserGPU = Multiply(*sGPU1, *sGPU2, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) &&
_CheckData(tMeGPU, answer, tUnitNum) &&
_CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(tMeGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -223,8 +223,8 @@ bool TestMultiply2()
tUser = Multiply(*s1, *s2);
/* check results */
cpuTest = _CheckData(tMe, answer, 1e-4, tUnitNum) &&
_CheckData(&tUser, answer, 1e-4, tUnitNum);
cpuTest = _CheckData(tMe, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......
......@@ -80,9 +80,9 @@ bool TestMultiplyDim1()
cUser = MultiplyDim(*a, *b, 0);
/* check results */
cpuTest = _CheckData(c, answer, aUnitNum) &&
_CheckData(cMe, answer, aUnitNum) &&
_CheckData(&cUser, answer, aUnitNum);
cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -107,9 +107,9 @@ bool TestMultiplyDim1()
cUserGPU = MultiplyDim(*aGPU, *bGPU, 0);
/* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) &&
_CheckData(cMeGPU, answer, aUnitNum) &&
_CheckData(&cUserGPU, answer, aUnitNum);
gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -192,9 +192,9 @@ bool TestMultiplyDim2()
cUser = MultiplyDim(*a, *b, 1);
/* check results */
cpuTest = _CheckData(c, answer, aUnitNum) &&
_CheckData(cMe, answer, aUnitNum) &&
_CheckData(&cUser, answer, aUnitNum);
cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -219,9 +219,9 @@ bool TestMultiplyDim2()
cUserGPU = MultiplyDim(*aGPU, *bGPU, 1);
/* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) &&
_CheckData(cMeGPU, answer, aUnitNum) &&
_CheckData(&cUserGPU, answer, aUnitNum);
gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -63,7 +63,9 @@ bool TestNegate1()
bUser = Negate(*a);
/* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) && _CheckData(aMe, answer, aUnitNum, 1e-4F) && _CheckData(&bUser, answer, aUnitNum, 1e-4F);
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(aMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -85,7 +87,9 @@ bool TestNegate1()
bUserGPU = Negate(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) && _CheckData(aMeGPU, answer, aUnitNum, 1e-4F) && _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -147,7 +151,9 @@ bool TestNegate2()
bUser = Negate(*a);
/* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) && _CheckData(aMe, answer, aUnitNum, 1e-4F) && _CheckData(&bUser, answer, aUnitNum, 1e-4F);
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(aMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -169,7 +175,9 @@ bool TestNegate2()
bUserGPU = Negate(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) && _CheckData(aMeGPU, answer, aUnitNum, 1e-4F) && _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -127,8 +127,9 @@ bool TestNormalize1()
tUser = Normalize(*s, 0, *mean, *var, *a, *b, 0.0F);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F)
&& _CheckData(tMe, answer, tUnitNum, 1e-4F) && _CheckData(&tUser, answer, tUnitNum, 1e-4F);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(tMe, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -159,8 +160,9 @@ bool TestNormalize1()
tUserGPU = Normalize(*sGPU, 0, *meanGPU, *varGPU, *aGPU, *bGPU, 0.0F);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F)
&& _CheckData(tMeGPU, answer, tUnitNum, 1e-4F) && _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(tMeGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -62,7 +62,8 @@ bool TestRectify1()
yUser = Rectify(*x);
/* check results */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -82,7 +83,8 @@ bool TestRectify1()
yUserGPU = Rectify(*xGPU);
/* check results */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......
......@@ -87,8 +87,10 @@ bool TestReduceMax1()
tUser2 = ReduceMax(*s, 1);
/* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1)
&& _CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2);
cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -113,8 +115,10 @@ bool TestReduceMax1()
tUserGPU2 = ReduceMax(*sGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1)
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2);
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */
delete s;
......@@ -182,7 +186,8 @@ bool TestReduceMax2()
tUser = ReduceMax(*s, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -203,7 +208,8 @@ bool TestReduceMax2()
tUserGPU = ReduceMax(*sGPU, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -82,8 +82,10 @@ bool TestReduceMean1()
tUser2 = ReduceMean(*s, 1);
/* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1)
&& _CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2);
cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -108,8 +110,10 @@ bool TestReduceMean1()
tUserGPU2 = ReduceMean(*sGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1)
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2);
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */
delete s;
......@@ -173,7 +177,8 @@ bool TestReduceMean2()
tUser = ReduceMean(*s, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -193,7 +198,8 @@ bool TestReduceMean2()
tUserGPU = ReduceMean(*sGPU, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -93,8 +93,10 @@ bool TestReduceSum1()
tUser2 = ReduceSum(*s, 1, *shift2);
/* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1) &&
_CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2);
cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -123,8 +125,10 @@ bool TestReduceSum1()
tUserGPU2 = ReduceSum(*sGPU, 1, *shiftGPU2);
/* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1) &&
_CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2);
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */
delete s;
......@@ -203,7 +207,8 @@ bool TestReduceSum2()
tUser = ReduceSum(*s, 1);
/* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum);
cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -222,7 +227,8 @@ bool TestReduceSum2()
tUserGPU = ReduceSum(*sGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum);
gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -292,7 +298,8 @@ bool TestReduceSum3()
tUser = ReduceSum(*s, 1);
/* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum);
cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -311,7 +318,8 @@ bool TestReduceSum3()
tUserGPU = ReduceSum(*sGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum);
gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -381,7 +389,8 @@ bool TestReduceSum4()
tUser = ReduceSum(*s, 1);
/* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum);
cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -400,7 +409,8 @@ bool TestReduceSum4()
tUserGPU = ReduceSum(*sGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum);
gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -472,7 +482,8 @@ bool TestReduceSum5()
tUser = ReduceSum(*s, 1);
/* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum);
cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -491,7 +502,8 @@ bool TestReduceSum5()
tUserGPU = ReduceSum(*sGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum);
gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -564,7 +576,8 @@ bool TestReduceSum6()
tUser = ReduceSum(*s, 1);
/* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum);
cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -583,7 +596,8 @@ bool TestReduceSum6()
tUserGPU = ReduceSum(*sGPU, 1);
/* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum);
gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -649,7 +663,8 @@ bool TestReduceSum7()
tUser = ReduceSum(*s, 0);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -669,7 +684,8 @@ bool TestReduceSum7()
tUserGPU = ReduceSum(*sGPU, 0);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -83,7 +83,8 @@ bool TestReduceSumSquared1()
tUser = ReduceSumSquared(*s, 0, *shift);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -105,7 +106,8 @@ bool TestReduceSumSquared1()
tUserGPU = ReduceSumSquared(*sGPU, 0, *shiftGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -191,7 +193,8 @@ bool TestReduceSumSquared2()
tUser = ReduceSumSquared(*s, 1, *shift);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -213,7 +216,8 @@ bool TestReduceSumSquared2()
tUserGPU = ReduceSumSquared(*sGPU, 1, *shiftGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -289,7 +293,8 @@ bool TestReduceSumSquared3()
tUser = ReduceSumSquared(*s, 0, *shift);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -311,7 +316,8 @@ bool TestReduceSumSquared3()
tUserGPU = ReduceSumSquared(*sGPU, 0, *shiftGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -83,7 +83,8 @@ bool TestReduceVariance1()
tUser = ReduceVariance(*s, 0, *mean);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -105,7 +106,8 @@ bool TestReduceVariance1()
tUserGPU = ReduceVariance(*sGPU, 0, *meanGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -181,7 +183,8 @@ bool TestReduceVariance2()
tUser = ReduceVariance(*s, 0, *mean);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -203,7 +206,8 @@ bool TestReduceVariance2()
tUserGPU = ReduceVariance(*sGPU, 0, *meanGPU);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -67,8 +67,9 @@ bool TestScaleAndShift1()
tUser = ScaleAndShift(*s, scaleFactor, shiftFactor);
/* check results */
cpuTest = _CheckData(t, answer, sUnitNum) &&
_CheckData(tMe, answer, sUnitNum) && _CheckData(&tUser, answer, sUnitNum);
cpuTest = _CheckData(t, answer, sUnitNum, 1e-4F) &&
_CheckData(tMe, answer, sUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -90,8 +91,9 @@ bool TestScaleAndShift1()
tUserGPU = ScaleAndShift(*sGPU, scaleFactor, shiftFactor);
/* check results */
gpuTest = _CheckData(tGPU, answer, sUnitNum) &&
_CheckData(tMeGPU, answer, sUnitNum) && _CheckData(&tUserGPU, answer, sUnitNum);
gpuTest = _CheckData(tGPU, answer, sUnitNum, 1e-4F) &&
_CheckData(tMeGPU, answer, sUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -79,7 +79,8 @@ bool TestSelect1()
tUser = SelectRange(*s, 2, 1, 3);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -99,7 +100,8 @@ bool TestSelect1()
tUserGPU = SelectRange(*sGPU, 2, 1, 3);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -54,7 +54,7 @@ bool TestSetAscendingOrder1()
SetAscendingOrder(*s, 1);
/* check results */
cpuTest = _CheckData(s, answer, sUnitNum);
cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -70,7 +70,7 @@ bool TestSetAscendingOrder1()
SetAscendingOrder(*sGPU, 1);
/* check results */
gpuTest = _CheckData(sGPU, answer, sUnitNum);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -126,7 +126,7 @@ bool TestSetData2()
_SetDataIndexed(s, modify, 0, 1);
/* check results */
cpuTest = _CheckData(s, answer, sUnitNum, 1e-5F);
cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -143,7 +143,7 @@ bool TestSetData2()
/* call SetDataIndexed function */
_SetDataIndexed(sGPU, modifyGPU, 0, 1);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-5F);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -220,7 +220,7 @@ bool TestSetData3()
_SetDataIndexed(s, modify, 1, 1);
/* check results */
cpuTest = _CheckData(s, answer, sUnitNum, 1e-5F);
cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -237,7 +237,7 @@ bool TestSetData3()
/* call SetDataIndexed function */
_SetDataIndexed(sGPU, modifyGPU, 1, 1);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-5F);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -66,7 +66,9 @@ bool TestSign1()
bUser = Sign(*a);
/* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) && _CheckData(aMe, answer, aUnitNum, 1e-4F) && _CheckData(&bUser, answer, aUnitNum, 1e-4F);
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(aMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -88,7 +90,9 @@ bool TestSign1()
bUserGPU = Sign(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) && _CheckData(aMeGPU, answer, aUnitNum, 1e-4F) && _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
delete b;
......
......@@ -67,7 +67,9 @@ bool TestSin1()
bUser = Sin(*a);
/* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -89,7 +91,9 @@ bool TestSin1()
bUserGPU = Sin(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -64,7 +64,8 @@ bool TestSoftmax1()
yUser = Softmax(*x, 1);
/* check result */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -84,7 +85,8 @@ bool TestSoftmax1()
yUserGPU = Softmax(*xGPU, 1);
/* check result */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......@@ -150,8 +152,8 @@ bool TestSoftmax2()
_SoftmaxBackward(g, y, x, dedy, dedx, NULL, 1, CROSSENTROPY);
/* check result */
cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F)
&& _CheckData(dedx, dedxAnswer, unitNum, 1e-4F);
cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F) &&
_CheckData(dedx, dedxAnswer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -178,8 +180,8 @@ bool TestSoftmax2()
_SoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, CROSSENTROPY);
/* check result */
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F)
&& _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) &&
_CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
/* destroy variables */
delete x;
......
......@@ -62,9 +62,9 @@ bool TestSort1()
_SortMe(aMe, index, 0);
Sort(*a, bUser, *index, 0);
cpuTest = _CheckData(b, answer, unitNum) &&
_CheckData(aMe, answer, unitNum) &&
_CheckData(&bUser, answer, unitNum);
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -88,9 +88,9 @@ bool TestSort1()
Sort(*aGPU, bUserGPU, *indexGPU, 0);
/* check results */
gpuTest = _CheckData(bGPU, answer, unitNum) &&
_CheckData(aMeGPU, answer, unitNum) &&
_CheckData(&bUserGPU, answer, unitNum);
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -154,9 +154,9 @@ bool TestSort2()
Sort(*a, bUser, *index, 1);
/* check results */
cpuTest = _CheckData(b, answer, unitNum) &&
_CheckData(aMe, answer, unitNum) &&
_CheckData(&bUser, answer, unitNum);
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -180,9 +180,9 @@ bool TestSort2()
Sort(*aGPU, bUserGPU, *indexGPU, 1);
/* check results */
gpuTest = _CheckData(bGPU, answer, unitNum) &&
_CheckData(aMeGPU, answer, unitNum) &&
_CheckData(&bUserGPU, answer, unitNum);
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -77,7 +77,8 @@ bool TestSplit1()
tUser = Split(*s, 0, 2);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -97,7 +98,8 @@ bool TestSplit1()
tUserGPU = Split(*sGPU, 0, 2);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -173,7 +175,8 @@ bool TestSplit2()
tUser = Split(*s, 1, 2);
/* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum);
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA
......@@ -194,7 +197,8 @@ bool TestSplit2()
tUserGPU = Split(*sGPU, 1, 2);
/* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum);
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -293,8 +297,10 @@ bool TestSplit3()
Split(*s, tUserList, 1, 2);
/* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1) &&
_CheckData(t2, answer2, tUnitNum2) && _CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2);
cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -328,8 +334,10 @@ bool TestSplit3()
Split(*sGPU, tUserList, 1, 2);
/* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1) &&
_CheckData(tGPU2, answer2, tUnitNum2) && _CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2);
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2, 1e-4F);
/* destroy variables */
delete s;
......
......@@ -98,7 +98,7 @@ bool TestSpread1()
_Spread(s, modify, 0, srcIndex, 2, tgtIndex);
/* check results */
cpuTest = _CheckData(s, answer, sUnitNum, 1e-5F);
cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -115,7 +115,7 @@ bool TestSpread1()
/* call _Spread function */
_Spread(sGPU, modifyGPU, 0, srcIndex, 2, tgtIndex);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-5F);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */
delete s;
......@@ -207,8 +207,8 @@ bool TestSpread2()
_SpreadForGather(s2, t, sIndex);
/* check results */
cpuTest = _CheckData(s1, answer, sUnitNum) &&
_CheckData(s2, answer, sUnitNum);
cpuTest = _CheckData(s1, answer, sUnitNum, 1e-4F) &&
_CheckData(s2, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -233,8 +233,8 @@ bool TestSpread2()
_SpreadForGather(sGPU2, tGPU, sIndexGPU);
/* check results */
gpuTest = _CheckData(sGPU1, answer, sUnitNum) &&
_CheckData(sGPU2, answer, sUnitNum);
gpuTest = _CheckData(sGPU1, answer, sUnitNum, 1e-4F) &&
_CheckData(sGPU2, answer, sUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......@@ -342,8 +342,8 @@ bool TestSpread3()
_SpreadForCopyIndexed(s2, t, dim, sIndex, tIndex, 1);
/* check results */
cpuTest = _CheckData(s1, answer, sUnitNum) &&
_CheckData(s2, answer, sUnitNum);
cpuTest = _CheckData(s1, answer, sUnitNum, 1e-4F) &&
_CheckData(s2, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -368,8 +368,8 @@ bool TestSpread3()
_SpreadForCopyIndexed(sGPU2, tGPU, dim, sIndexGPU, tIndexGPU, 1);
/* check results */
gpuTest = _CheckData(sGPU1, answer, sUnitNum) &&
_CheckData(sGPU2, answer, sUnitNum);
gpuTest = _CheckData(sGPU1, answer, sUnitNum, 1e-4F) &&
_CheckData(sGPU2, answer, sUnitNum, 1e-4F);
/* destroy variables */
delete s1;
......
......@@ -66,8 +66,9 @@ bool TestSub1()
cUser = Sub(*a, *b);
/* check results */
cpuTest = _CheckData(c, answer, unitNum)
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum);
cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
_CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -92,8 +93,9 @@ bool TestSub1()
cUserGPU = Sub(*aGPU, *bGPU);
/* check results */
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F)
&& _CheckData(cMeGPU, answer, unitNum, 1e-4F) && _CheckData(&cUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -162,8 +164,9 @@ bool TestSub2()
cUser = Sub(*a, *b, beta);
/* check results */
cpuTest = _CheckData(c, answer, unitNum)
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum);
cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
_CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -188,8 +191,9 @@ bool TestSub2()
cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F)
&& _CheckData(cMeGPU, answer, unitNum, 1e-4F) && _CheckData(&cUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -267,7 +271,7 @@ bool TestSub3()
cUser = Sub(*a, *b, beta);
/* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum);
cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -286,7 +290,7 @@ bool TestSub3()
cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum);
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -369,7 +373,7 @@ bool TestSub4()
cUser = Sub(*a, *b, beta);
/* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum);
cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -388,7 +392,7 @@ bool TestSub4()
cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum);
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -471,7 +475,7 @@ bool TestSub5()
cUser = Sub(*a, *b, beta);
/* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum);
cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -490,7 +494,7 @@ bool TestSub5()
cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum);
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -66,8 +66,9 @@ bool TestSum1()
cUser = Sum(*a, *b);
/* check results */
cpuTest = _CheckData(c, answer, unitNum)
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum);
cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
_CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -92,8 +93,9 @@ bool TestSum1()
cUserGPU = Sum(*aGPU, *bGPU);
/* check results */
gpuTest = _CheckData(cGPU, answer, unitNum)
&& _CheckData(cMeGPU, answer, unitNum) && _CheckData(&cUserGPU, answer, unitNum);
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -162,8 +164,9 @@ bool TestSum2()
cUser = Sum(*a, *b, beta);
/* check results */
cpuTest = _CheckData(c, answer, unitNum)
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum);
cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
_CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -188,8 +191,9 @@ bool TestSum2()
cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(cGPU, answer, unitNum)
&& _CheckData(cMeGPU, answer, unitNum) && _CheckData(&cUserGPU, answer, unitNum);
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -267,7 +271,7 @@ bool TestSum3()
cUser = Sum(*a, *b, beta);
/* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum);
cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -286,7 +290,7 @@ bool TestSum3()
cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum);
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -369,7 +373,7 @@ bool TestSum4()
cUser = Sum(*a, *b, beta);
/* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum);
cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -388,7 +392,7 @@ bool TestSum4()
cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum);
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -471,7 +475,7 @@ bool TestSum5()
cUser = Sum(*a, *b, beta);
/* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum);
cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -490,7 +494,7 @@ bool TestSum5()
cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum);
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -82,9 +82,9 @@ bool TestSumDim1()
cUser = SumDim(*a, *b, 0);
/* check results */
cpuTest = _CheckData(c, answer, aUnitNum) &&
_CheckData(cMe, answer, aUnitNum) &&
_CheckData(&cUser, answer, aUnitNum);
cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -109,9 +109,9 @@ bool TestSumDim1()
cUserGPU = SumDim(*aGPU, *bGPU, 0);
/* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) &&
_CheckData(cMeGPU, answer, aUnitNum) &&
_CheckData(&cUserGPU, answer, aUnitNum);
gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -196,9 +196,9 @@ bool TestSumDim2()
cUser = SumDim(*a, *b, 1);
/* check results */
cpuTest = _CheckData(c, answer, aUnitNum) &&
_CheckData(cMe, answer, aUnitNum) &&
_CheckData(&cUser, answer, aUnitNum);
cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -223,9 +223,9 @@ bool TestSumDim2()
cUserGPU = SumDim(*aGPU, *bGPU, 1);
/* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) &&
_CheckData(cMeGPU, answer, aUnitNum) &&
_CheckData(&cUserGPU, answer, aUnitNum);
gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -305,9 +305,9 @@ bool TestSumDim3()
cUser = SumDim(*a, *b, 1);
/* check results */
cpuTest = _CheckData(c, answer->data, aUnitNum) &&
_CheckData(cMe, answer->data, aUnitNum) &&
_CheckData(&cUser, answer->data, aUnitNum);
cpuTest = _CheckData(c, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer->data, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -331,9 +331,9 @@ bool TestSumDim3()
cUserGPU = SumDim(*aGPU, *bGPU, 1);
/* check results */
gpuTest = _CheckData(cGPU, answer->data, aUnitNum) &&
_CheckData(cMeGPU, answer->data, aUnitNum) &&
_CheckData(&cUserGPU, answer->data, aUnitNum);
gpuTest = _CheckData(cGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer->data, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -414,9 +414,9 @@ bool TestSumDim4()
cUser = SumDim(*a, *b, 1);
/* check results */
cpuTest = _CheckData(c, answer->data, aUnitNum) &&
_CheckData(cMe, answer->data, aUnitNum) &&
_CheckData(&cUser, answer->data, aUnitNum);
cpuTest = _CheckData(c, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer->data, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -440,9 +440,9 @@ bool TestSumDim4()
cUserGPU = SumDim(*aGPU, *bGPU, 1);
/* check results */
gpuTest = _CheckData(cGPU, answer->data, aUnitNum) &&
_CheckData(cMeGPU, answer->data, aUnitNum) &&
_CheckData(&cUserGPU, answer->data, aUnitNum);
gpuTest = _CheckData(cGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer->data, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -67,7 +67,9 @@ bool TestTan1()
bUser = Tan(*a);
/* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F);
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -89,7 +91,9 @@ bool TestTan1()
bUserGPU = Tan(*aGPU);
/* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -73,8 +73,8 @@ bool TestTranspose1()
bUser = Transpose(*a, 0, 1);
/* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F)
&& _CheckData(&bUser, answer, aUnitNum, 1e-4F);
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -93,8 +93,8 @@ bool TestTranspose1()
bUserGPU = Transpose(*aGPU, 0, 1);
/* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F)
&& _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......@@ -179,8 +179,8 @@ bool TestTranspose2()
bUser = Transpose(*a, 0, 2);
/* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F)
&& _CheckData(&bUser, answer, aUnitNum, 1e-4F);
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -199,8 +199,8 @@ bool TestTranspose2()
bUserGPU = Transpose(*aGPU, 0, 2);
/* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F)
&& _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */
delete a;
......
......@@ -100,8 +100,10 @@ bool TestUnsqueeze1()
tUser2 = Unsqueeze(*s, 2, 2);
/* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1) &&
_CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2);
cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
......@@ -126,8 +128,10 @@ bool TestUnsqueeze1()
tUserGPU2 = Unsqueeze(*sGPU, 2, 2);
/* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1)
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2);
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */
delete s;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论