Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
9f1d4a15
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9f1d4a15
编写于
4月 17, 2019
作者:
G
Guo Sheng
提交者:
GitHub
4月 17, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16902 from guoshengCS/refine-infer-shape
Refine ENFORCE in infer_shape of gru_op and lstm_unit_op.
上级
caf28483
f641a47b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
6 deletion
+11
-6
paddle/fluid/operators/gru_op.cc
paddle/fluid/operators/gru_op.cc
+5
-2
paddle/fluid/operators/lstm_unit_op.cc
paddle/fluid/operators/lstm_unit_op.cc
+6
-4
未找到文件。
paddle/fluid/operators/gru_op.cc
浏览文件 @
9f1d4a15
...
...
@@ -47,8 +47,11 @@ class GRUOp : public framework::OperatorWithKernel {
auto
weight_dims
=
ctx
->
GetInputDim
(
"Weight"
);
int
input_size
=
input_dims
[
1
];
int
frame_size
=
weight_dims
[
0
];
PADDLE_ENFORCE_EQ
(
input_size
,
frame_size
*
3
,
"The input_size must be 3 times of frame_size in GRUOp."
);
if
(
ctx
->
IsRuntime
())
{
PADDLE_ENFORCE_EQ
(
input_size
,
frame_size
*
3
,
"The input_size must be 3 times of frame_size in GRUOp."
);
}
PADDLE_ENFORCE_EQ
(
weight_dims
[
1
],
frame_size
*
3
,
"The shape of Weight matrix must be [frame_size, frame_size * 3]."
);
...
...
paddle/fluid/operators/lstm_unit_op.cc
浏览文件 @
9f1d4a15
...
...
@@ -34,10 +34,12 @@ class LstmUnitOp : public framework::OperatorWithKernel {
auto
c_prev_dims
=
ctx
->
GetInputDim
(
"C_prev"
);
PADDLE_ENFORCE_EQ
(
x_dims
.
size
(),
2
,
"Input(X)'s rank must be 2."
);
PADDLE_ENFORCE_EQ
(
x_dims
[
0
],
c_prev_dims
[
0
],
"Batch size of inputs and states must be equal"
);
PADDLE_ENFORCE_EQ
(
x_dims
[
1
],
c_prev_dims
[
1
]
*
4
,
"Dimension of FC should equal to prev state * 4"
);
if
(
ctx
->
IsRuntime
())
{
PADDLE_ENFORCE_EQ
(
x_dims
[
0
],
c_prev_dims
[
0
],
"Batch size of inputs and states must be equal"
);
PADDLE_ENFORCE_EQ
(
x_dims
[
1
],
c_prev_dims
[
1
]
*
4
,
"Dimension of FC should equal to prev state * 4"
);
}
int
b_size
=
c_prev_dims
[
0
];
// batch size
int
s_dim
=
c_prev_dims
[
1
];
// state dim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录