Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
NiuTrans.Tensor
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
8
Issues
8
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
NiuTrans
NiuTrans.Tensor
Commits
79c659b5
Commit
79c659b5
authored
Oct 23, 2019
by
liyinqiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CheckData function.
parent
b3ecba16
隐藏空白字符变更
内嵌
并排
正在显示
55 个修改的文件
包含
369 行增加
和
369 行删除
+369
-369
source/tensor/core/utilities/CheckData.cpp
+2
-2
source/tensor/core/utilities/CheckData.h
+2
-2
source/tensor/test/TAbsolute.cpp
+2
-2
source/tensor/test/TClip.cpp
+6
-6
source/tensor/test/TCompare.cpp
+6
-6
source/tensor/test/TConcatenate.cpp
+8
-8
source/tensor/test/TConcatenateSolely.cpp
+6
-6
source/tensor/test/TConvertDataType.cpp
+6
-6
source/tensor/test/TCopyIndexed.cpp
+30
-30
source/tensor/test/TCopyValues.cpp
+2
-2
source/tensor/test/TCos.cpp
+2
-2
source/tensor/test/TCrossEntropy.cpp
+2
-2
source/tensor/test/TDiv.cpp
+6
-6
source/tensor/test/TDivDim.cpp
+12
-12
source/tensor/test/TExp.cpp
+6
-6
source/tensor/test/TGather.cpp
+4
-4
source/tensor/test/THardTanH.cpp
+6
-6
source/tensor/test/TIdentity.cpp
+6
-6
source/tensor/test/TLog.cpp
+2
-2
source/tensor/test/TLogSoftmax.cpp
+9
-9
source/tensor/test/TMatrixMul.cpp
+8
-8
source/tensor/test/TMatrixMul2D.cpp
+4
-4
source/tensor/test/TMatrixMul2DParallel.cpp
+2
-2
source/tensor/test/TMatrixMulBatched.cpp
+4
-4
source/tensor/test/TMerge.cpp
+10
-10
source/tensor/test/TMultiply.cpp
+6
-6
source/tensor/test/TMultiplyDim.cpp
+12
-12
source/tensor/test/TNegate.cpp
+4
-4
source/tensor/test/TNormalize.cpp
+4
-4
source/tensor/test/TPower.cpp
+18
-18
source/tensor/test/TRectify.cpp
+4
-4
source/tensor/test/TReduceMax.cpp
+4
-4
source/tensor/test/TReduceMean.cpp
+4
-4
source/tensor/test/TReduceSum.cpp
+14
-14
source/tensor/test/TReduceSumSquared.cpp
+4
-4
source/tensor/test/TReduceVariance.cpp
+2
-2
source/tensor/test/TRound.cpp
+6
-6
source/tensor/test/TScaleAndShift.cpp
+4
-4
source/tensor/test/TSelect.cpp
+2
-2
source/tensor/test/TSetAscendingOrder.cpp
+2
-2
source/tensor/test/TSetData.cpp
+12
-12
source/tensor/test/TSigmoid.cpp
+8
-8
source/tensor/test/TSign.cpp
+2
-2
source/tensor/test/TSin.cpp
+2
-2
source/tensor/test/TSoftmax.cpp
+6
-6
source/tensor/test/TSort.cpp
+12
-12
source/tensor/test/TSplit.cpp
+8
-8
source/tensor/test/TSpread.cpp
+10
-10
source/tensor/test/TSub.cpp
+8
-8
source/tensor/test/TSubDim.cpp
+12
-12
source/tensor/test/TSum.cpp
+8
-8
source/tensor/test/TSumDim.cpp
+24
-24
source/tensor/test/TTan.cpp
+2
-2
source/tensor/test/TTranspose.cpp
+8
-8
source/tensor/test/TUnsqueeze.cpp
+4
-4
没有找到文件。
source/tensor/core/utilities/CheckData.cpp
查看文件 @
79c659b5
...
...
@@ -43,7 +43,7 @@ bool IsFloatEqual(DTYPE a, DTYPE b, float absError, float relError)
>> num - number of data items
>> beg - where we start this in the data array of the tensor
*/
bool
CheckData
(
const
XTensor
*
tensor
,
const
void
*
d
,
int
num
,
int
beg
)
bool
_
CheckData
(
const
XTensor
*
tensor
,
const
void
*
d
,
int
num
,
int
beg
)
{
if
(
tensor
->
data
==
NULL
||
d
==
NULL
)
return
false
;
...
...
@@ -68,7 +68,7 @@ bool CheckData(const XTensor * tensor, const void * d, int num, int beg)
}
/* check whether the data array is the same as the "answer" */
bool
CheckData
(
const
XTensor
*
tensor
,
const
void
*
d
,
int
num
,
float
tolerance
,
int
beg
)
bool
_
CheckData
(
const
XTensor
*
tensor
,
const
void
*
d
,
int
num
,
float
tolerance
,
int
beg
)
{
if
(
tensor
->
data
==
NULL
||
d
==
NULL
)
return
false
;
...
...
source/tensor/core/utilities/CheckData.h
查看文件 @
79c659b5
...
...
@@ -27,10 +27,10 @@
namespace
nts
{
// namespace nts(NiuTrans.Tensor)
/* check whether the data array is the same as the answer */
bool
CheckData
(
const
XTensor
*
tensor
,
const
void
*
answer
,
int
num
,
int
beg
=
0
);
bool
_
CheckData
(
const
XTensor
*
tensor
,
const
void
*
answer
,
int
num
,
int
beg
=
0
);
/* check whether the data array is the same as the answer */
bool
CheckData
(
const
XTensor
*
tensor
,
const
void
*
answer
,
int
num
,
float
tolerance
,
int
beg
=
0
);
bool
_
CheckData
(
const
XTensor
*
tensor
,
const
void
*
answer
,
int
num
,
float
tolerance
,
int
beg
=
0
);
}
// namespace nts(NiuTrans.Tensor)
...
...
source/tensor/test/TAbsolute.cpp
查看文件 @
79c659b5
...
...
@@ -67,7 +67,7 @@ bool TestAbsolute1()
bUser
=
Absolute
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -89,7 +89,7 @@ bool TestAbsolute1()
bUserGPU
=
Absolute
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TClip.cpp
查看文件 @
79c659b5
...
...
@@ -68,9 +68,9 @@ bool TestClip1()
bUser
=
Clip
(
*
a
,
-
1.0
,
1.0
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -92,9 +92,9 @@ bool TestClip1()
bUserGPU
=
Clip
(
*
aGPU
,
-
1.0
,
1.0
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TCompare.cpp
查看文件 @
79c659b5
...
...
@@ -68,9 +68,9 @@ bool TestCompare1()
bUser
=
Equal
(
*
a
,
1.0
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -92,9 +92,9 @@ bool TestCompare1()
bUserGPU
=
Equal
(
*
aGPU
,
1.0
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TConcatenate.cpp
查看文件 @
79c659b5
...
...
@@ -93,7 +93,7 @@ bool TestConcatenate1()
tUser
=
Concatenate
(
*
sList
,
1
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -122,7 +122,7 @@ bool TestConcatenate1()
tUserGPU
=
Concatenate
(
*
sList
,
1
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
sList
;
...
...
@@ -222,7 +222,7 @@ bool TestConcatenate2()
tUser
=
Concatenate
(
*
sList
,
0
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -251,7 +251,7 @@ bool TestConcatenate2()
tUserGPU
=
Concatenate
(
*
sList
,
0
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
sList
;
...
...
@@ -349,7 +349,7 @@ bool TestConcatenate3()
tUser
=
Concatenate
(
*
sList
,
1
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -378,7 +378,7 @@ bool TestConcatenate3()
tUserGPU
=
Concatenate
(
*
sList
,
1
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
sList
;
...
...
@@ -469,7 +469,7 @@ bool TestConcatenate4()
tUser
=
Concatenate
(
*
s1
,
*
s2
,
1
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -491,7 +491,7 @@ bool TestConcatenate4()
tUserGPU
=
Concatenate
(
*
sGPU1
,
*
sGPU2
,
1
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TConcatenateSolely.cpp
查看文件 @
79c659b5
...
...
@@ -92,7 +92,7 @@ bool TestConcatenateSolely1()
_ConcatenateSolely
(
sList
,
t
,
1
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
);
cpuTest
=
_
CheckData
(
t
,
answer
,
tUnitNum
);
#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
);
/* 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
);
#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
);
/* 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
);
#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
);
/* destroy variables */
delete
sList
;
...
...
source/tensor/test/TConvertDataType.cpp
查看文件 @
79c659b5
...
...
@@ -64,7 +64,7 @@ bool TestConvertDataType1()
_ConvertDataType
(
a
,
b
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
);
#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
);
/* destroy variables */
delete
a
;
...
...
@@ -139,7 +139,7 @@ bool TestConvertDataType2()
_ConvertDataType
(
a
,
b
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -156,7 +156,7 @@ bool TestConvertDataType2()
_ConvertDataType
(
aGPU
,
bGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
@@ -238,7 +238,7 @@ bool TestConvertDataType3()
//_ConvertDataType(b, c);
/* check results */
//cpuTest = CheckData(a, data1, unitNum1, 1e-4F);
//cpuTest =
_
CheckData(a, data1, unitNum1, 1e-4F);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -264,7 +264,7 @@ bool TestConvertDataType3()
_ConvertDataType
(
eGPU
,
fGPU
);
/* check results */
gpuTest
=
CheckData
(
fGPU
,
answer
,
unitNum3
,
1e-4
F
);
gpuTest
=
_
CheckData
(
fGPU
,
answer
,
unitNum3
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TCopyIndexed.cpp
查看文件 @
79c659b5
...
...
@@ -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
)
&&
_
CheckData
(
t2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#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
)
&&
_
CheckData
(
tGPU2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* 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
)
&&
_
CheckData
(
t2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#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
)
&&
_
CheckData
(
tGPU2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* 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
)
&&
_
CheckData
(
t2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#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
)
&&
_
CheckData
(
tGPU2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* 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
)
&&
_
CheckData
(
t2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#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
)
&&
_
CheckData
(
tGPU2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* 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
)
&&
_
CheckData
(
t2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#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
)
&&
_
CheckData
(
tGPU2
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TCopyValues.cpp
查看文件 @
79c659b5
...
...
@@ -58,7 +58,7 @@ bool TestCopyValues1()
tUser
=
CopyValues
(
*
s
);
/* check results */
cpuTest
=
CheckData
(
t
,
sData
,
sUnitNum
)
&&
CheckData
(
&
tUser
,
sData
,
sUnitNum
);
cpuTest
=
_CheckData
(
t
,
sData
,
sUnitNum
)
&&
_
CheckData
(
&
tUser
,
sData
,
sUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -78,7 +78,7 @@ bool TestCopyValues1()
tUserGPU
=
CopyValues
(
*
sGPU
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
sData
,
sUnitNum
)
&&
CheckData
(
&
tUser
,
sData
,
sUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
sData
,
sUnitNum
)
&&
_
CheckData
(
&
tUser
,
sData
,
sUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TCos.cpp
查看文件 @
79c659b5
...
...
@@ -67,7 +67,7 @@ bool TestCos1()
bUser
=
Cos
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -89,7 +89,7 @@ bool TestCos1()
bUserGPU
=
Cos
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TCrossEntropy.cpp
查看文件 @
79c659b5
...
...
@@ -277,7 +277,7 @@ bool TestCrossEntropy3()
_CrossEntropyFast
(
output
,
gold
,
loss
,
weight
);
/* check results */
cpuTest
=
CheckData
(
loss
,
answer
,
4
,
1e-4
F
);
cpuTest
=
_
CheckData
(
loss
,
answer
,
4
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -302,7 +302,7 @@ bool TestCrossEntropy3()
_CrossEntropyFast
(
outputGPU
,
goldGPU
,
lossGPU
,
weightGPU
);
/* check results */
gpuTest
=
CheckData
(
lossGPU
,
answer
,
4
,
1e-4
F
);
gpuTest
=
_
CheckData
(
lossGPU
,
answer
,
4
,
1e-4
F
);
/* destroy variables */
delete
output
;
...
...
source/tensor/test/TDiv.cpp
查看文件 @
79c659b5
...
...
@@ -90,9 +90,9 @@ bool TestDiv1()
tUser
=
Div
(
*
s1
,
*
s2
,
0
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
tMe
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
t
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_
CheckData
(
tMe
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -117,9 +117,9 @@ bool TestDiv1()
tUserGPU
=
Div
(
*
sGPU1
,
*
sGPU2
,
0
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
tMeGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
tGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_
CheckData
(
tMeGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
,
1e-4
F
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TDivDim.cpp
查看文件 @
79c659b5
...
...
@@ -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
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* 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
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TExp.cpp
查看文件 @
79c659b5
...
...
@@ -67,9 +67,9 @@ bool TestExp1()
bUser
=
Exp
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -91,9 +91,9 @@ bool TestExp1()
bUserGPU
=
Exp
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
\
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
\
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TGather.cpp
查看文件 @
79c659b5
...
...
@@ -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
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/THardTanH.cpp
查看文件 @
79c659b5
...
...
@@ -65,7 +65,7 @@ bool TestHardTanH1()
yUser
=
HardTanH
(
*
x
);
/* check results */
cpuTest
=
CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -85,7 +85,7 @@ bool TestHardTanH1()
yUserGPU
=
HardTanH
(
*
xGPU
);
/* check results */
gpuTest
=
CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
@@ -159,8 +159,8 @@ bool TestHardTanH2()
_HardTanHBackward
(
y
,
x
,
dedy
,
dedx
);
/* check results */
cpuTest
=
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -185,8 +185,8 @@ bool TestHardTanH2()
_HardTanHBackward
(
yGPU
,
xGPU
,
dedyGPU
,
dedxGPU
);
/* check results */
gpuTest
=
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
source/tensor/test/TIdentity.cpp
查看文件 @
79c659b5
...
...
@@ -63,7 +63,7 @@ bool TestIdentity1()
yUser
=
Identity
(
*
x
);
/* check result */
cpuTest
=
CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -83,7 +83,7 @@ bool TestIdentity1()
yUserGPU
=
Identity
(
*
xGPU
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
@@ -147,8 +147,8 @@ bool TestIdentity2()
_IdentityBackward
(
y
,
x
,
dedy
,
dedx
);
/* check result */
cpuTest
=
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -173,8 +173,8 @@ bool TestIdentity2()
_IdentityBackward
(
yGPU
,
xGPU
,
dedyGPU
,
dedxGPU
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
source/tensor/test/TLog.cpp
查看文件 @
79c659b5
...
...
@@ -67,7 +67,7 @@ bool TestLog1()
bUser
=
Log
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -89,7 +89,7 @@ bool TestLog1()
bUserGPU
=
Log
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TLogSoftmax.cpp
查看文件 @
79c659b5
...
...
@@ -63,7 +63,7 @@ bool TestLogSoftmax1()
yUser
=
LogSoftmax
(
*
x
,
1
);
/* check result */
cpuTest
=
CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -83,7 +83,7 @@ bool TestLogSoftmax1()
yUserGPU
=
LogSoftmax
(
*
xGPU
,
1
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
@@ -150,8 +150,8 @@ bool TestLogSoftmax2()
_LogSoftmaxBackward
(
g
,
y
,
x
,
dedy
,
dedx
,
NULL
,
1
,
CROSSENTROPY
);
/* check result */
cpuTest
=
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -178,7 +178,7 @@ bool TestLogSoftmax2()
_LogSoftmaxBackward
(
gGPU
,
yGPU
,
xGPU
,
dedyGPU
,
dedxGPU
,
NULL
,
1
,
CROSSENTROPY
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
@@ -254,8 +254,8 @@ bool TestLogSoftmax3()
_LogSoftmaxBackward
(
g
,
y
,
x
,
dedy
,
dedx
,
NULL
,
1
,
SQUAREDERROR
);
/* check result */
cpuTest
=
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -282,8 +282,8 @@ bool TestLogSoftmax3()
_LogSoftmaxBackward
(
gGPU
,
yGPU
,
xGPU
,
dedyGPU
,
dedxGPU
,
NULL
,
1
,
SQUAREDERROR
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-3
F
);
gpuTest
=
_
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-3
F
);
/* destroy variables */
delete
x
;
...
...
source/tensor/test/TMatrixMul.cpp
查看文件 @
79c659b5
...
...
@@ -88,7 +88,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -110,7 +110,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
@@ -202,7 +202,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -224,7 +224,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
@@ -336,7 +336,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -358,7 +358,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
@@ -459,7 +459,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -481,7 +481,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TMatrixMul2D.cpp
查看文件 @
79c659b5
...
...
@@ -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
);
#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
);
/* 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
);
#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
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TMatrixMul2DParallel.cpp
查看文件 @
79c659b5
...
...
@@ -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
);
/* 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
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TMatrixMulBatched.cpp
查看文件 @
79c659b5
...
...
@@ -88,7 +88,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -110,7 +110,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
@@ -210,7 +210,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -232,7 +232,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TMerge.cpp
查看文件 @
79c659b5
...
...
@@ -72,7 +72,7 @@ bool TestMerge1()
tUser
=
Merge
(
*
s
,
1
,
0
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -92,7 +92,7 @@ bool TestMerge1()
tUserGPU
=
Merge
(
*
sGPU
,
1
,
0
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -186,8 +186,8 @@ 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
)
&&
_
CheckData
(
&
tUser1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
t2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUser2
,
answer2
,
tUnitNum2
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -212,8 +212,8 @@ 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
)
&&
_
CheckData
(
&
tUserGPU1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
tGPU2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUserGPU2
,
answer2
,
tUnitNum2
);
/* destroy variables */
delete
s
;
...
...
@@ -302,7 +302,7 @@ bool TestMerge3()
tUser
=
Merge
(
*
smallList
,
0
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -331,7 +331,7 @@ bool TestMerge3()
tUserGPU
=
Merge
(
*
smallList
,
0
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
@@ -418,7 +418,7 @@ bool TestMerge4()
tUser
=
Merge
(
*
smallList
,
1
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -447,7 +447,7 @@ bool TestMerge4()
tUserGPU
=
Merge
(
*
smallList
,
1
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TMultiply.cpp
查看文件 @
79c659b5
...
...
@@ -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
)
&&
_
CheckData
(
tMe
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#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
)
&&
_
CheckData
(
tMeGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TMultiplyDim.cpp
查看文件 @
79c659b5
...
...
@@ -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
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* 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
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TNegate.cpp
查看文件 @
79c659b5
...
...
@@ -63,7 +63,7 @@ bool TestNegate1()
bUser
=
Negate
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -85,7 +85,7 @@ bool TestNegate1()
bUserGPU
=
Negate
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
@@ -147,7 +147,7 @@ bool TestNegate2()
bUser
=
Negate
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -169,7 +169,7 @@ bool TestNegate2()
bUserGPU
=
Negate
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TNormalize.cpp
查看文件 @
79c659b5
...
...
@@ -127,8 +127,8 @@ bool TestNormalize1()
tUser
=
Normalize
(
*
s
,
0
,
*
mean
,
*
var
,
*
a
,
*
b
,
0.0
F
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
tMe
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
t
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_CheckData
(
tMe
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -159,8 +159,8 @@ bool TestNormalize1()
tUserGPU
=
Normalize
(
*
sGPU
,
0
,
*
meanGPU
,
*
varGPU
,
*
aGPU
,
*
bGPU
,
0.0
F
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
tMeGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
tGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_CheckData
(
tMeGPU
,
answer
,
tUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
,
1e-4
F
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TPower.cpp
查看文件 @
79c659b5
...
...
@@ -68,9 +68,9 @@ bool TestPower1()
bUser
=
Power
(
*
a
,
2.0
F
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -92,9 +92,9 @@ bool TestPower1()
bUserGPU
=
Power
(
*
aGPU
,
2.0
F
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
@@ -159,9 +159,9 @@ bool TestPower2()
bUser
=
Power
(
*
a
,
1.0
F
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -183,9 +183,9 @@ bool TestPower2()
bUserGPU
=
Power
(
*
aGPU
,
1.0
F
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
@@ -250,9 +250,9 @@ bool TestPower3()
bUser
=
Power
(
*
a
,
0.0
F
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -274,9 +274,9 @@ bool TestPower3()
bUserGPU
=
Power
(
*
aGPU
,
0.0
F
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TRectify.cpp
查看文件 @
79c659b5
...
...
@@ -62,7 +62,7 @@ bool TestRectify1()
yUser
=
Rectify
(
*
x
);
/* check results */
cpuTest
=
CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -82,7 +82,7 @@ bool TestRectify1()
yUserGPU
=
Rectify
(
*
xGPU
);
/* check results */
gpuTest
=
CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
@@ -150,7 +150,7 @@ bool TestRectify2()
_RectifyBackward
(
y
,
x
,
dedy
,
dedx
);
/* check results */
cpuTest
=
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -174,7 +174,7 @@ bool TestRectify2()
_RectifyBackward
(
yGPU
,
xGPU
,
dedyGPU
,
dedxGPU
);
/* check results */
gpuTest
=
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
source/tensor/test/TReduceMax.cpp
查看文件 @
79c659b5
...
...
@@ -87,8 +87,8 @@ 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
)
&&
_
CheckData
(
&
tUser1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
t2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUser2
,
answer2
,
tUnitNum2
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -113,8 +113,8 @@ 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
)
&&
_
CheckData
(
&
tUserGPU1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
tGPU2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUserGPU2
,
answer2
,
tUnitNum2
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TReduceMean.cpp
查看文件 @
79c659b5
...
...
@@ -82,8 +82,8 @@ 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
)
&&
_
CheckData
(
&
tUser1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
t2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUser2
,
answer2
,
tUnitNum2
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -108,8 +108,8 @@ 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
)
&&
_
CheckData
(
&
tUserGPU1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
tGPU2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUserGPU2
,
answer2
,
tUnitNum2
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TReduceSum.cpp
查看文件 @
79c659b5
...
...
@@ -93,8 +93,8 @@ 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
)
&&
_
CheckData
(
&
tUser1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
t2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUser2
,
answer2
,
tUnitNum2
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -123,8 +123,8 @@ 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
)
&&
_
CheckData
(
&
tUserGPU1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
tGPU2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUserGPU2
,
answer2
,
tUnitNum2
);
/* destroy variables */
delete
s
;
...
...
@@ -203,7 +203,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
->
data
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -222,7 +222,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
->
data
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -292,7 +292,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
->
data
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -311,7 +311,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
->
data
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -381,7 +381,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
->
data
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -400,7 +400,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
->
data
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -472,7 +472,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
->
data
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -491,7 +491,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
->
data
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -564,7 +564,7 @@ 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
)
&&
_
CheckData
(
&
tUser
,
answer
->
data
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -583,7 +583,7 @@ 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
)
&&
_
CheckData
(
&
tUserGPU
,
answer
->
data
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TReduceSumSquared.cpp
查看文件 @
79c659b5
...
...
@@ -83,7 +83,7 @@ bool TestReduceSumSquared1()
tUser
=
ReduceSumSquared
(
*
s
,
0
,
*
shift
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -105,7 +105,7 @@ bool TestReduceSumSquared1()
tUserGPU
=
ReduceSumSquared
(
*
sGPU
,
0
,
*
shiftGPU
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -191,7 +191,7 @@ bool TestReduceSumSquared2()
tUser
=
ReduceSumSquared
(
*
s
,
1
,
*
shift
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -213,7 +213,7 @@ bool TestReduceSumSquared2()
tUserGPU
=
ReduceSumSquared
(
*
sGPU
,
1
,
*
shiftGPU
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TReduceVariance.cpp
查看文件 @
79c659b5
...
...
@@ -83,7 +83,7 @@ bool TestReduceVariance1()
tUser
=
ReduceVariance
(
*
s
,
0
,
*
mean
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -105,7 +105,7 @@ bool TestReduceVariance1()
tUserGPU
=
ReduceVariance
(
*
sGPU
,
0
,
*
meanGPU
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TRound.cpp
查看文件 @
79c659b5
...
...
@@ -69,9 +69,9 @@ bool TestRound1()
//bUser = Round(*a);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -93,9 +93,9 @@ bool TestRound1()
//bUserGPU = Round(*aGPU);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TScaleAndShift.cpp
查看文件 @
79c659b5
...
...
@@ -67,8 +67,8 @@ 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
)
&&
_CheckData
(
tMe
,
answer
,
sUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
sUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -90,8 +90,8 @@ 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
)
&&
_CheckData
(
tMeGPU
,
answer
,
sUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
sUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TSelect.cpp
查看文件 @
79c659b5
...
...
@@ -79,7 +79,7 @@ bool TestSelect1()
tUser
=
SelectRange
(
*
s
,
2
,
1
,
3
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -99,7 +99,7 @@ bool TestSelect1()
tUserGPU
=
SelectRange
(
*
sGPU
,
2
,
1
,
3
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TSetAscendingOrder.cpp
查看文件 @
79c659b5
...
...
@@ -53,7 +53,7 @@ bool TestSetAscendingOrder1()
s
->
SetAscendingOrder
(
1
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
sUnitNum
);
cpuTest
=
_
CheckData
(
s
,
answer
,
sUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -69,7 +69,7 @@ bool TestSetAscendingOrder1()
sGPU
->
SetAscendingOrder
(
1
);
/* check results */
gpuTest
=
CheckData
(
sGPU
,
answer
,
sUnitNum
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
sUnitNum
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TSetData.cpp
查看文件 @
79c659b5
...
...
@@ -53,7 +53,7 @@ bool TestSetData1()
s
->
SetDataRand
(
0.0
,
1.0
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
sUnitNum
,
1.0
F
);
cpuTest
=
_
CheckData
(
s
,
answer
,
sUnitNum
,
1.0
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -65,7 +65,7 @@ bool TestSetData1()
/* call SetDataRand function */
sGPU
->
SetDataRand
(
0.0
,
1.0
);
gpuTest
=
CheckData
(
sGPU
,
answer
,
sUnitNum
,
1.0
F
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
sUnitNum
,
1.0
F
);
/* destroy variables */
delete
s
;
...
...
@@ -126,7 +126,7 @@ bool TestSetData2()
_SetDataIndexed
(
s
,
modify
,
0
,
1
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
sUnitNum
,
1e-5
F
);
cpuTest
=
_
CheckData
(
s
,
answer
,
sUnitNum
,
1e-5
F
);
#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-5
F
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
sUnitNum
,
1e-5
F
);
/* destroy variables */
delete
s
;
...
...
@@ -220,7 +220,7 @@ bool TestSetData3()
_SetDataIndexed
(
s
,
modify
,
1
,
1
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
sUnitNum
,
1e-5
F
);
cpuTest
=
_
CheckData
(
s
,
answer
,
sUnitNum
,
1e-5
F
);
#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-5
F
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
sUnitNum
,
1e-5
F
);
/* destroy variables */
delete
s
;
...
...
@@ -295,7 +295,7 @@ bool TestSetData4()
_SetDataDim
(
s
,
1
,
1
,
0
,
0
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
s
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -310,7 +310,7 @@ bool TestSetData4()
/* call _SetDataDim function */
_SetDataDim
(
sGPU
,
1
,
1
,
0
,
0
);
gpuTest
=
CheckData
(
sGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
s
;
...
...
@@ -375,7 +375,7 @@ bool TestSetData5()
_SetDataDim
(
s
,
2
,
1
,
1
,
5.0
F
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
s
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -390,7 +390,7 @@ bool TestSetData5()
/* call _SetDataDim function */
_SetDataDim
(
sGPU
,
2
,
1
,
1
,
5.0
F
);
gpuTest
=
CheckData
(
sGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
s
;
...
...
@@ -437,7 +437,7 @@ bool TestSetData6()
_SetDataRange
(
s
,
5.2
,
-
3.2
,
-
2
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
s
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -452,7 +452,7 @@ bool TestSetData6()
/* call _SetDataRange function */
_SetDataRange
(
sGPU
,
5.2
,
-
3.2
,
-
2
);
gpuTest
=
CheckData
(
sGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TSigmoid.cpp
查看文件 @
79c659b5
...
...
@@ -60,8 +60,8 @@ bool TestSigmoid1()
yUser
=
Sigmoid
(
*
x
);
/* check result */
cpuTest
=
CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -81,8 +81,8 @@ bool TestSigmoid1()
yUserGPU
=
Sigmoid
(
*
xGPU
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
@@ -148,8 +148,8 @@ bool TestSigmoid2()
_SigmoidBackward
(
y
,
x
,
dedy
,
dedx
);
/* check result */
cpuTest
=
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -174,8 +174,8 @@ bool TestSigmoid2()
_SigmoidBackward
(
yGPU
,
xGPU
,
dedyGPU
,
dedxGPU
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
source/tensor/test/TSign.cpp
查看文件 @
79c659b5
...
...
@@ -66,7 +66,7 @@ bool TestSign1()
bUser
=
Sign
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -88,7 +88,7 @@ bool TestSign1()
bUserGPU
=
Sign
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
delete
b
;
...
...
source/tensor/test/TSin.cpp
查看文件 @
79c659b5
...
...
@@ -67,7 +67,7 @@ bool TestSin1()
bUser
=
Sin
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -89,7 +89,7 @@ bool TestSin1()
bUserGPU
=
Sin
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TSoftmax.cpp
查看文件 @
79c659b5
...
...
@@ -64,7 +64,7 @@ bool TestSoftmax1()
yUser
=
Softmax
(
*
x
,
1
);
/* check result */
cpuTest
=
CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
y
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -84,7 +84,7 @@ bool TestSoftmax1()
yUserGPU
=
Softmax
(
*
xGPU
,
1
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
yGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
yUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
@@ -150,8 +150,8 @@ bool TestSoftmax2()
_SoftmaxBackward
(
g
,
y
,
x
,
dedy
,
dedx
,
NULL
,
1
,
CROSSENTROPY
);
/* check result */
cpuTest
=
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
y
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedx
,
dedxAnswer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -178,8 +178,8 @@ bool TestSoftmax2()
_SoftmaxBackward
(
gGPU
,
yGPU
,
xGPU
,
dedyGPU
,
dedxGPU
,
NULL
,
1
,
CROSSENTROPY
);
/* check result */
gpuTest
=
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
yGPU
,
yAnswer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
dedxGPU
,
dedxAnswer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
x
;
...
...
source/tensor/test/TSort.cpp
查看文件 @
79c659b5
...
...
@@ -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
)
&&
_
CheckData
(
aMe
,
answer
,
unitNum
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
);
#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
)
&&
_
CheckData
(
aMeGPU
,
answer
,
unitNum
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
);
/* 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
)
&&
_
CheckData
(
aMe
,
answer
,
unitNum
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
);
#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
)
&&
_
CheckData
(
aMeGPU
,
answer
,
unitNum
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TSplit.cpp
查看文件 @
79c659b5
...
...
@@ -77,7 +77,7 @@ bool TestSplit1()
tUser
=
Split
(
*
s
,
0
,
2
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -97,7 +97,7 @@ bool TestSplit1()
tUserGPU
=
Split
(
*
sGPU
,
0
,
2
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -173,7 +173,7 @@ bool TestSplit2()
tUser
=
Split
(
*
s
,
1
,
2
);
/* check results */
cpuTest
=
CheckData
(
t
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
cpuTest
=
_CheckData
(
t
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUser
,
answer
,
tUnitNum
);
#ifdef USE_CUDA
...
...
@@ -194,7 +194,7 @@ bool TestSplit2()
tUserGPU
=
Split
(
*
sGPU
,
1
,
2
);
/* check results */
gpuTest
=
CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
gpuTest
=
_CheckData
(
tGPU
,
answer
,
tUnitNum
)
&&
_
CheckData
(
&
tUserGPU
,
answer
,
tUnitNum
);
/* destroy variables */
delete
s
;
...
...
@@ -293,8 +293,8 @@ 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
)
&&
_
CheckData
((
XTensor
*
)
tUserList
.
Get
(
0
),
answer1
,
tUnitNum1
)
&&
_CheckData
(
t2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
((
XTensor
*
)
tUserList
.
Get
(
1
),
answer2
,
tUnitNum2
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -328,8 +328,8 @@ 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
)
&&
_
CheckData
((
XTensor
*
)
tUserList
.
Get
(
0
),
answer1
,
tUnitNum1
)
&&
_CheckData
(
tGPU2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
((
XTensor
*
)
tUserList
.
Get
(
1
),
answer2
,
tUnitNum2
);
/* destroy variables */
delete
s
;
...
...
source/tensor/test/TSpread.cpp
查看文件 @
79c659b5
...
...
@@ -98,7 +98,7 @@ bool TestSpread1()
_Spread
(
s
,
modify
,
0
,
srcIndex
,
2
,
tgtIndex
);
/* check results */
cpuTest
=
CheckData
(
s
,
answer
,
sUnitNum
,
1e-5
F
);
cpuTest
=
_
CheckData
(
s
,
answer
,
sUnitNum
,
1e-5
F
);
#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-5
F
);
gpuTest
=
_
CheckData
(
sGPU
,
answer
,
sUnitNum
,
1e-5
F
);
/* 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
)
&&
_
CheckData
(
s2
,
answer
,
sUnitNum
);
#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
)
&&
_
CheckData
(
sGPU2
,
answer
,
sUnitNum
);
/* 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
)
&&
_
CheckData
(
s2
,
answer
,
sUnitNum
);
#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
)
&&
_
CheckData
(
sGPU2
,
answer
,
sUnitNum
);
/* destroy variables */
delete
s1
;
...
...
source/tensor/test/TSub.cpp
查看文件 @
79c659b5
...
...
@@ -66,8 +66,8 @@ 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
)
&&
_CheckData
(
cMe
,
answer
,
unitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
unitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -92,8 +92,8 @@ bool TestSub1()
cUserGPU
=
Sub
(
*
aGPU
,
*
bGPU
);
/* check results */
gpuTest
=
CheckData
(
cGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
cMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
cUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
cGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
cMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
@@ -162,8 +162,8 @@ 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
)
&&
_CheckData
(
cMe
,
answer
,
unitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
unitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -188,8 +188,8 @@ bool TestSub2()
cUserGPU
=
Sub
(
*
aGPU
,
*
bGPU
,
beta
);
/* check results */
gpuTest
=
CheckData
(
cGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
cMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
cUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
cGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
cMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TSubDim.cpp
查看文件 @
79c659b5
...
...
@@ -80,9 +80,9 @@ bool TestSubDim1()
cUser
=
SubDim
(
*
a
,
*
b
,
0
);
/* check results */
cpuTest
=
CheckData
(
c
,
answer
,
aUnitNum
)
&&
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
cpuTest
=
_
CheckData
(
c
,
answer
,
aUnitNum
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -107,9 +107,9 @@ bool TestSubDim1()
cUserGPU
=
SubDim
(
*
aGPU
,
*
bGPU
,
0
);
/* check results */
gpuTest
=
CheckData
(
cGPU
,
answer
,
aUnitNum
)
&&
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
gpuTest
=
_
CheckData
(
cGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* destroy variables */
delete
a
;
...
...
@@ -193,9 +193,9 @@ bool TestSubDim2()
cUser
=
SubDim
(
*
a
,
*
b
,
1
);
/* check results */
cpuTest
=
CheckData
(
c
,
answer
,
aUnitNum
)
&&
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
cpuTest
=
_
CheckData
(
c
,
answer
,
aUnitNum
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -220,9 +220,9 @@ bool TestSubDim2()
cUserGPU
=
SubDim
(
*
aGPU
,
*
bGPU
,
1
);
/* check results */
gpuTest
=
CheckData
(
cGPU
,
answer
,
aUnitNum
)
&&
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
gpuTest
=
_
CheckData
(
cGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TSum.cpp
查看文件 @
79c659b5
...
...
@@ -66,8 +66,8 @@ 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
)
&&
_CheckData
(
cMe
,
answer
,
unitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
unitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -92,8 +92,8 @@ 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
)
&&
_CheckData
(
cMeGPU
,
answer
,
unitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
unitNum
);
/* destroy variables */
delete
a
;
...
...
@@ -162,8 +162,8 @@ 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
)
&&
_CheckData
(
cMe
,
answer
,
unitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
unitNum
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -188,8 +188,8 @@ 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
)
&&
_CheckData
(
cMeGPU
,
answer
,
unitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
unitNum
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TSumDim.cpp
查看文件 @
79c659b5
...
...
@@ -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
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* 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
)
&&
_
CheckData
(
cMe
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
,
aUnitNum
);
/* 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
)
&&
_
CheckData
(
cMe
,
answer
->
data
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
->
data
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
->
data
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
->
data
,
aUnitNum
);
/* 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
)
&&
_
CheckData
(
cMe
,
answer
->
data
,
aUnitNum
)
&&
_
CheckData
(
&
cUser
,
answer
->
data
,
aUnitNum
);
#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
)
&&
_
CheckData
(
cMeGPU
,
answer
->
data
,
aUnitNum
)
&&
_
CheckData
(
&
cUserGPU
,
answer
->
data
,
aUnitNum
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TTan.cpp
查看文件 @
79c659b5
...
...
@@ -67,7 +67,7 @@ bool TestTan1()
bUser
=
Tan
(
*
a
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
cpuTest
=
_CheckData
(
b
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMe
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
unitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -89,7 +89,7 @@ bool TestTan1()
bUserGPU
=
Tan
(
*
aGPU
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
gpuTest
=
_CheckData
(
bGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_CheckData
(
aMeGPU
,
answer
,
unitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
unitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TTranspose.cpp
查看文件 @
79c659b5
...
...
@@ -73,8 +73,8 @@ bool TestTranspose1()
bUser
=
Transpose
(
*
a
,
0
,
1
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -93,8 +93,8 @@ bool TestTranspose1()
bUserGPU
=
Transpose
(
*
aGPU
,
0
,
1
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
@@ -179,8 +179,8 @@ bool TestTranspose2()
bUser
=
Transpose
(
*
a
,
0
,
2
);
/* check results */
cpuTest
=
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
cpuTest
=
_
CheckData
(
b
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUser
,
answer
,
aUnitNum
,
1e-4
F
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -199,8 +199,8 @@ bool TestTranspose2()
bUserGPU
=
Transpose
(
*
aGPU
,
0
,
2
);
/* check results */
gpuTest
=
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
gpuTest
=
_
CheckData
(
bGPU
,
answer
,
aUnitNum
,
1e-4
F
)
&&
_
CheckData
(
&
bUserGPU
,
answer
,
aUnitNum
,
1e-4
F
);
/* destroy variables */
delete
a
;
...
...
source/tensor/test/TUnsqueeze.cpp
查看文件 @
79c659b5
...
...
@@ -100,8 +100,8 @@ 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
)
&&
_
CheckData
(
&
tUser1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
t2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUser2
,
answer2
,
tUnitNum2
);
#ifdef USE_CUDA
/* GPU test */
...
...
@@ -126,8 +126,8 @@ 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
)
&&
_
CheckData
(
&
tUserGPU1
,
answer1
,
tUnitNum1
)
&&
_CheckData
(
tGPU2
,
answer2
,
tUnitNum2
)
&&
_
CheckData
(
&
tUserGPU2
,
answer2
,
tUnitNum2
);
/* destroy variables */
delete
s
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论