Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wk1234123
Paddle
提交
fe04175e
P
Paddle
项目概览
wk1234123
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fe04175e
编写于
8月 05, 2017
作者:
Y
Yi Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix comparison between signed and unsigned values
上级
338d861f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
32 addition
and
32 deletion
+32
-32
paddle/framework/operator_test.cc
paddle/framework/operator_test.cc
+4
-4
paddle/function/BufferArgTest.cpp
paddle/function/BufferArgTest.cpp
+1
-1
paddle/function/FunctionTest.cpp
paddle/function/FunctionTest.cpp
+6
-6
paddle/function/TensorShapeTest.cpp
paddle/function/TensorShapeTest.cpp
+12
-12
paddle/function/TensorTypeTest.cpp
paddle/function/TensorTypeTest.cpp
+7
-7
paddle/gserver/layers/PrintLayer.cpp
paddle/gserver/layers/PrintLayer.cpp
+1
-1
paddle/math/tests/test_matrixCompare.cpp
paddle/math/tests/test_matrixCompare.cpp
+1
-1
未找到文件。
paddle/framework/operator_test.cc
浏览文件 @
fe04175e
...
...
@@ -157,22 +157,22 @@ class CPUKernalMultiInputsTest : public OpKernel {
ASSERT_EQ
(
xs
[
2
],
"x2"
);
auto
inVar0
=
ctx
.
MultiInputVar
(
"xs"
);
ASSERT_EQ
(
inVar0
.
size
(),
3
);
ASSERT_EQ
(
inVar0
.
size
(),
3
U
);
auto
intVar1
=
ctx
.
InputVar
(
"k"
);
ASSERT_NE
(
intVar1
,
nullptr
);
auto
outVar0
=
ctx
.
MultiOutputVar
(
"ys"
);
ASSERT_EQ
(
outVar0
.
size
(),
2
);
ASSERT_EQ
(
outVar0
.
size
(),
2
U
);
auto
inTensor0
=
ctx
.
MultiInput
<
Tensor
>
(
"xs"
);
ASSERT_EQ
(
inTensor0
.
size
(),
3
);
ASSERT_EQ
(
inTensor0
.
size
(),
3
U
);
auto
intTensor1
=
ctx
.
Input
<
Tensor
>
(
"k"
);
ASSERT_NE
(
intTensor1
,
nullptr
);
auto
outTensor0
=
ctx
.
MultiOutput
<
Tensor
>
(
"ys"
);
ASSERT_EQ
(
outTensor0
.
size
(),
2
);
ASSERT_EQ
(
outTensor0
.
size
(),
2
U
);
auto
k
=
ctx
.
op_
.
Input
(
"k"
);
ASSERT_EQ
(
k
,
"k0"
);
...
...
paddle/function/BufferArgTest.cpp
浏览文件 @
fe04175e
...
...
@@ -32,7 +32,7 @@ TEST(BufferTest, SequenceIdArg) {
sizeOfValuType
(
VALUE_TYPE_INT32
));
SequenceIdArg
buffer
(
memory
.
getBuf
(),
shape
);
EXPECT_EQ
(
buffer
.
data
(),
memory
.
getBuf
());
EXPECT_EQ
(
buffer
.
numSeqs
(),
9
);
EXPECT_EQ
(
buffer
.
numSeqs
(),
9
U
);
}
}
// namespace paddle
paddle/function/FunctionTest.cpp
浏览文件 @
fe04175e
...
...
@@ -24,14 +24,14 @@ void FunctionApi(typename Tensor<real, DType>::Matrix& output,
template
<
>
void
FunctionApi
<
DEVICE_TYPE_CPU
>
(
CpuMatrix
&
output
,
const
CpuMatrix
&
input
)
{
EXPECT_EQ
(
output
.
getHeight
(),
100
);
EXPECT_EQ
(
output
.
getWidth
(),
200
);
EXPECT_EQ
(
output
.
getHeight
(),
100
U
);
EXPECT_EQ
(
output
.
getWidth
(),
200
U
);
}
template
<
>
void
FunctionApi
<
DEVICE_TYPE_GPU
>
(
GpuMatrix
&
output
,
const
GpuMatrix
&
input
)
{
EXPECT_EQ
(
output
.
getHeight
(),
10
);
EXPECT_EQ
(
output
.
getWidth
(),
20
);
EXPECT_EQ
(
output
.
getHeight
(),
10
U
);
EXPECT_EQ
(
output
.
getWidth
(),
20
U
);
}
template
<
DeviceType
DType
>
...
...
@@ -85,14 +85,14 @@ void testBufferArgs(const BufferArgs& inputs,
}
void
testBufferArgs
(
const
BufferArgs
&
inputs
,
const
CheckBufferArg
&
check
)
{
EXPECT_EQ
(
inputs
.
size
(),
1
);
EXPECT_EQ
(
inputs
.
size
(),
1
U
);
check
(
inputs
[
0
]);
}
TEST
(
Arguments
,
Matrix
)
{
MatrixPtr
matrix
=
Matrix
::
create
(
100
,
200
);
CheckBufferArg
check
=
[
=
](
const
BufferArg
&
arg
)
{
EXPECT_EQ
(
arg
.
shape
().
ndims
(),
2
);
EXPECT_EQ
(
arg
.
shape
().
ndims
(),
2
U
);
EXPECT_EQ
(
arg
.
shape
()[
0
],
100
);
EXPECT_EQ
(
arg
.
shape
()[
1
],
200
);
EXPECT_EQ
(
arg
.
data
(),
matrix
->
getData
());
...
...
paddle/function/TensorShapeTest.cpp
浏览文件 @
fe04175e
...
...
@@ -19,35 +19,35 @@ namespace paddle {
TEST
(
TensorShape
,
Constructor
)
{
TensorShape
t1
;
EXPECT_EQ
(
t1
.
ndims
(),
0
);
EXPECT_EQ
(
t1
.
getElements
(),
0
);
EXPECT_EQ
(
t1
.
ndims
(),
0
U
);
EXPECT_EQ
(
t1
.
getElements
(),
0
U
);
TensorShape
t2
(
3
);
EXPECT_EQ
(
t2
.
ndims
(),
3
);
EXPECT_EQ
(
t2
.
getElements
(),
1
);
EXPECT_EQ
(
t2
.
ndims
(),
3
U
);
EXPECT_EQ
(
t2
.
getElements
(),
1
U
);
TensorShape
t3
({
8
,
10
});
EXPECT_EQ
(
t3
.
ndims
(),
2
);
EXPECT_EQ
(
t3
.
getElements
(),
80
);
EXPECT_EQ
(
t3
.
ndims
(),
2
U
);
EXPECT_EQ
(
t3
.
getElements
(),
80
U
);
TensorShape
t4
(
t3
);
EXPECT_EQ
(
t4
.
ndims
(),
t3
.
ndims
());
EXPECT_EQ
(
t4
.
getElements
(),
t3
.
getElements
());
TensorShape
t5
({
1
,
2
,
3
,
4
,
5
});
EXPECT_EQ
(
t5
.
ndims
(),
5
);
EXPECT_EQ
(
t5
.
getElements
(),
120
);
EXPECT_EQ
(
t5
.
ndims
(),
5
U
);
EXPECT_EQ
(
t5
.
getElements
(),
120
U
);
}
TEST
(
TensorShape
,
GetAndSet
)
{
TensorShape
t
({
1
,
2
,
3
});
EXPECT_EQ
(
t
.
ndims
(),
3
);
EXPECT_EQ
(
t
.
getElements
(),
6
);
EXPECT_EQ
(
t
.
ndims
(),
3
U
);
EXPECT_EQ
(
t
.
getElements
(),
6
U
);
EXPECT_EQ
(
t
[
1
],
2
);
t
.
setDim
(
1
,
100
);
EXPECT_EQ
(
t
.
getElements
(),
300
);
EXPECT_EQ
(
t
[
1
],
100
);
EXPECT_EQ
(
t
.
getElements
(),
300
U
);
EXPECT_EQ
(
t
[
1
],
100
U
);
}
}
// namespace paddle
paddle/function/TensorTypeTest.cpp
浏览文件 @
fe04175e
...
...
@@ -19,9 +19,9 @@ namespace paddle {
TEST
(
TensorType
,
Matrix
)
{
Tensor
<
real
,
DEVICE_TYPE_CPU
>::
Matrix
matrix
(
100
,
200
);
EXPECT_EQ
(
matrix
.
getHeight
(),
100
);
EXPECT_EQ
(
matrix
.
getWidth
(),
200
);
EXPECT_EQ
(
matrix
.
getElementCnt
(),
100
*
200
);
EXPECT_EQ
(
matrix
.
getHeight
(),
100
U
);
EXPECT_EQ
(
matrix
.
getWidth
(),
200
U
);
EXPECT_EQ
(
matrix
.
getElementCnt
(),
100
U
*
200U
);
EXPECT_EQ
(
matrix
.
useGpu
(),
false
);
Tensor
<
real
,
DEVICE_TYPE_GPU
>::
Matrix
testGpu
(
100
,
200
);
...
...
@@ -33,15 +33,15 @@ TEST(TensorType, Vector) {
Tensor
<
real
,
DEVICE_TYPE_GPU
>::
Vector
gpuVector
(
100
);
EXPECT_EQ
(
cpuVector
.
useGpu
(),
false
);
EXPECT_EQ
(
gpuVector
.
useGpu
(),
true
);
EXPECT_EQ
(
cpuVector
.
getSize
(),
100
);
EXPECT_EQ
(
gpuVector
.
getSize
(),
100
);
EXPECT_EQ
(
cpuVector
.
getSize
(),
100
U
);
EXPECT_EQ
(
gpuVector
.
getSize
(),
100
U
);
Tensor
<
int
,
DEVICE_TYPE_CPU
>::
Vector
cpuIVector
(
100
);
Tensor
<
int
,
DEVICE_TYPE_GPU
>::
Vector
gpuIVector
(
100
);
EXPECT_EQ
(
cpuIVector
.
useGpu
(),
false
);
EXPECT_EQ
(
gpuIVector
.
useGpu
(),
true
);
EXPECT_EQ
(
cpuIVector
.
getSize
(),
100
);
EXPECT_EQ
(
gpuIVector
.
getSize
(),
100
);
EXPECT_EQ
(
cpuIVector
.
getSize
(),
100
U
);
EXPECT_EQ
(
gpuIVector
.
getSize
(),
100
U
);
}
TEST
(
TensorType
,
EmptyMatrix
)
{
...
...
paddle/gserver/layers/PrintLayer.cpp
浏览文件 @
fe04175e
...
...
@@ -29,7 +29,7 @@ public:
vals
.
push_back
(
s
.
str
());
}
size_t
pos
=
0
;
in
t
i
=
0
;
size_
t
i
=
0
;
std
::
ostringstream
s
;
const
std
::
string
&
format
=
config_
.
user_arg
();
while
(
true
)
{
...
...
paddle/math/tests/test_matrixCompare.cpp
浏览文件 @
fe04175e
...
...
@@ -1146,7 +1146,7 @@ void testBatch2seqPadding(int batchSize, int inputDim) {
IVectorPtr
cpuSequence
;
generateSequenceStartPositions
(
batchSize
,
cpuSequence
);
for
(
int
i
=
0
;
i
<
cpuSequence
->
getSize
(
);
++
i
)
{
for
(
int
i
=
0
;
i
<
int
(
cpuSequence
->
getSize
()
);
++
i
)
{
(
cpuSequence
->
getData
())[
i
]
+=
1
;
// so no way that maxSeqLen is 0;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录