Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
ee11f006
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看板
未验证
提交
ee11f006
编写于
11月 01, 2017
作者:
Q
Qiao Longfei
提交者:
GitHub
11月 01, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add shareLod (#5259)
* add shareLod * fix sequence_conv grad infershape
上级
360cb183
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
7 deletion
+33
-7
paddle/framework/op_desc.cc
paddle/framework/op_desc.cc
+16
-0
paddle/framework/operator.cc
paddle/framework/operator.cc
+14
-0
paddle/framework/shape_inference.cc
paddle/framework/shape_inference.cc
+0
-3
paddle/framework/shape_inference.h
paddle/framework/shape_inference.h
+2
-3
paddle/operators/sequence_conv_op.cc
paddle/operators/sequence_conv_op.cc
+1
-1
未找到文件。
paddle/framework/op_desc.cc
浏览文件 @
ee11f006
...
...
@@ -52,6 +52,22 @@ class CompileTimeInferShapeContext : public InferShapeContext {
const
std
::
vector
<
std
::
string
>
&
Outputs
(
const
std
::
string
&
name
)
const
override
;
void
ShareLoD
(
const
std
::
string
&
in
,
const
std
::
string
&
out
,
size_t
i
=
0
,
size_t
j
=
0
)
const
override
{
PADDLE_ENFORCE_LT
(
i
,
Inputs
(
in
).
size
());
PADDLE_ENFORCE_LT
(
j
,
Outputs
(
out
).
size
());
auto
*
in_var
=
block_
.
FindVarRecursive
(
Inputs
(
in
)[
i
]);
auto
*
out_var
=
block_
.
FindVarRecursive
(
Outputs
(
out
)[
j
]);
if
(
in_var
->
GetType
()
!=
VarDesc
::
LOD_TENSOR
)
{
VLOG
(
3
)
<<
"input "
<<
in
<<
"is not LodTensor"
;
return
;
}
PADDLE_ENFORCE_EQ
(
in_var
->
GetType
(),
VarDesc
::
LOD_TENSOR
,
"The %d-th output of Output(%s) must be LoDTensor."
,
j
,
out
);
in_var
->
SetLoDLevel
(
out_var
->
GetLodLevel
());
}
private:
DDim
GetDim
(
const
std
::
string
&
name
)
const
override
;
...
...
paddle/framework/operator.cc
浏览文件 @
ee11f006
...
...
@@ -351,6 +351,20 @@ class RuntimeInferShapeContext : public InferShapeContext {
return
op_
.
Outputs
(
name
);
}
void
ShareLoD
(
const
std
::
string
&
in
,
const
std
::
string
&
out
,
size_t
i
=
0
,
size_t
j
=
0
)
const
override
{
PADDLE_ENFORCE_LT
(
i
,
Inputs
(
in
).
size
());
PADDLE_ENFORCE_LT
(
j
,
Outputs
(
out
).
size
());
Variable
*
in_var
=
scope_
.
FindVar
(
Inputs
(
in
)[
i
]);
Variable
*
out_var
=
scope_
.
FindVar
(
Outputs
(
out
)[
j
]);
if
(
!
in_var
->
IsType
<
LoDTensor
>
())
return
;
PADDLE_ENFORCE
(
out_var
->
IsType
<
LoDTensor
>
(),
"The %d-th output of Output(%s) must be LoDTensor."
,
j
,
out
);
auto
in_tensor
=
in_var
->
Get
<
LoDTensor
>
();
auto
*
out_tensor
=
out_var
->
GetMutable
<
LoDTensor
>
();
out_tensor
->
set_lod
(
in_tensor
.
lod
());
}
private:
DDim
GetDim
(
const
std
::
string
&
name
)
const
override
{
Variable
*
var
=
scope_
.
FindVar
(
name
);
...
...
paddle/framework/shape_inference.cc
浏览文件 @
ee11f006
...
...
@@ -28,9 +28,6 @@ void InferShapeContext::SetOutputsDim(
SetDims
(
names
,
dims
);
}
void
InferShapeContext
::
ShareLoD
(
const
std
::
string
&
in
,
const
std
::
string
&
out
,
size_t
i
,
size_t
j
)
const
{}
std
::
vector
<
framework
::
DDim
>
InferShapeContext
::
GetDims
(
const
std
::
vector
<
std
::
string
>
&
names
)
const
{
std
::
vector
<
framework
::
DDim
>
ret
;
...
...
paddle/framework/shape_inference.h
浏览文件 @
ee11f006
...
...
@@ -43,9 +43,8 @@ class InferShapeContext {
virtual
const
std
::
vector
<
std
::
string
>
&
Outputs
(
const
std
::
string
&
name
)
const
=
0
;
// TODO(qiao) implement this function
void
ShareLoD
(
const
std
::
string
&
in
,
const
std
::
string
&
out
,
size_t
i
=
0
,
size_t
j
=
0
)
const
;
virtual
void
ShareLoD
(
const
std
::
string
&
in
,
const
std
::
string
&
out
,
size_t
i
=
0
,
size_t
j
=
0
)
const
=
0
;
protected:
virtual
framework
::
DDim
GetDim
(
const
std
::
string
&
name
)
const
=
0
;
...
...
paddle/operators/sequence_conv_op.cc
浏览文件 @
ee11f006
...
...
@@ -89,7 +89,7 @@ class SequenceConvGradOp : public framework::OperatorWithKernel {
}
if
(
ctx
->
HasOutput
(
framework
::
GradVarName
(
"X"
)))
{
ctx
->
SetOutputDim
(
framework
::
GradVarName
(
"X"
),
ctx
->
GetInputDim
(
"X"
));
ctx
->
ShareLoD
(
framework
::
GradVarName
(
"X"
),
"X"
);
ctx
->
ShareLoD
(
"X"
,
framework
::
GradVarName
(
"X"
)
);
}
if
(
ctx
->
HasOutput
(
framework
::
GradVarName
(
"Filter"
)))
{
ctx
->
SetOutputDim
(
framework
::
GradVarName
(
"Filter"
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录