Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
极客李华
Paddle
提交
bc09551e
P
Paddle
项目概览
极客李华
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
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,发现更多精彩内容 >>
提交
bc09551e
编写于
7月 25, 2017
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix unittest
上级
e3f5fdcc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
8 deletion
+8
-8
paddle/framework/net_op_test.cc
paddle/framework/net_op_test.cc
+1
-1
paddle/framework/op_registry_test.cc
paddle/framework/op_registry_test.cc
+5
-5
paddle/framework/tensor_test.cc
paddle/framework/tensor_test.cc
+2
-2
未找到文件。
paddle/framework/net_op_test.cc
浏览文件 @
bc09551e
...
...
@@ -69,7 +69,7 @@ TEST(OpKernel, all) {
net
->
Run
(
scope
,
dev_ctx
);
ASSERT_EQ
(
2
,
infer_shape_cnt
);
ASSERT_EQ
(
2
,
run_cnt
);
ASSERT_THROW
(
net
->
AddOp
(
op2
),
std
::
runtime_error
);
ASSERT_THROW
(
net
->
AddOp
(
op2
),
paddle
::
platform
::
EnforceNotMet
);
}
TEST
(
AddBackwardOp
,
TestGradOp
)
{
auto
net
=
std
::
make_shared
<
PlainNet
>
();
...
...
paddle/framework/op_registry_test.cc
浏览文件 @
bc09551e
...
...
@@ -90,7 +90,7 @@ TEST(OpRegistry, IllegalAttr) {
bool
caught
=
false
;
try
{
paddle
::
framework
::
OpRegistry
::
CreateOp
(
op_desc
);
}
catch
(
std
::
runtime_error
&
err
)
{
}
catch
(
paddle
::
platform
::
EnforceNotMet
err
)
{
caught
=
true
;
std
::
string
msg
=
"larger_than check fail"
;
const
char
*
err_msg
=
err
.
what
();
...
...
@@ -136,7 +136,7 @@ TEST(OpRegistry, CustomChecker) {
bool
caught
=
false
;
try
{
paddle
::
framework
::
OpRegistry
::
CreateOp
(
op_desc
);
}
catch
(
std
::
runtime_error
&
err
)
{
}
catch
(
paddle
::
platform
::
EnforceNotMet
err
)
{
caught
=
true
;
std
::
string
msg
=
"Attribute 'test_attr' is required!"
;
const
char
*
err_msg
=
err
.
what
();
...
...
@@ -154,7 +154,7 @@ TEST(OpRegistry, CustomChecker) {
caught
=
false
;
try
{
paddle
::
framework
::
OpRegistry
::
CreateOp
(
op_desc
);
}
catch
(
std
::
runtime_error
&
err
)
{
}
catch
(
paddle
::
platform
::
EnforceNotMet
err
)
{
caught
=
true
;
std
::
string
msg
=
"'test_attr' must be even!"
;
const
char
*
err_msg
=
err
.
what
();
...
...
@@ -192,7 +192,7 @@ TEST(ProtoMaker, DuplicatedAttr) {
pd
::
OpProto
op_proto
;
pd
::
OpAttrChecker
op_checker
;
auto
proto_maker
=
TestAttrProtoMaker
(
&
op_proto
,
&
op_checker
);
ASSERT_THROW
(
proto_maker
.
Validate
(),
std
::
runtime_error
);
ASSERT_THROW
(
proto_maker
.
Validate
(),
paddle
::
platform
::
EnforceNotMet
);
}
class
TestInOutProtoMaker
:
public
pd
::
OpProtoAndCheckerMaker
{
...
...
@@ -208,5 +208,5 @@ TEST(ProtoMaker, DuplicatedInOut) {
pd
::
OpProto
op_proto
;
pd
::
OpAttrChecker
op_checker
;
auto
proto_maker
=
TestInOutProtoMaker
(
&
op_proto
,
&
op_checker
);
ASSERT_THROW
(
proto_maker
.
Validate
(),
std
::
runtime_error
);
ASSERT_THROW
(
proto_maker
.
Validate
(),
paddle
::
platform
::
EnforceNotMet
);
}
paddle/framework/tensor_test.cc
浏览文件 @
bc09551e
...
...
@@ -33,7 +33,7 @@ TEST(Tensor, DataAssert) {
bool
caught
=
false
;
try
{
src_tensor
.
data
<
double
>
();
}
catch
(
std
::
runtime_error
&
err
)
{
}
catch
(
paddle
::
platform
::
EnforceNotMet
err
)
{
caught
=
true
;
std
::
string
msg
=
"Tenosr holds no memory. Call Tensor::mutable_data first."
;
...
...
@@ -107,7 +107,7 @@ TEST(Tensor, ShareDataWith) {
bool
caught
=
false
;
try
{
dst_tensor
.
ShareDataWith
<
float
>
(
src_tensor
);
}
catch
(
std
::
runtime_error
&
err
)
{
}
catch
(
paddle
::
platform
::
EnforceNotMet
err
)
{
caught
=
true
;
std
::
string
msg
=
"Tenosr holds no memory. Call Tensor::mutable_data first."
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录