Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
cc82ff0d
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cc82ff0d
编写于
1月 25, 2018
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of upstream into add_lstmp_doc
上级
4ca19d4e
7333df85
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
11 deletion
+10
-11
paddle/operators/pool_op.h
paddle/operators/pool_op.h
+2
-4
python/paddle/v2/fluid/distribute_transpiler.py
python/paddle/v2/fluid/distribute_transpiler.py
+2
-2
python/paddle/v2/fluid/tests/book/test_rnn_encoder_decoder.py
...on/paddle/v2/fluid/tests/book/test_rnn_encoder_decoder.py
+6
-5
未找到文件。
paddle/operators/pool_op.h
浏览文件 @
cc82ff0d
...
@@ -139,10 +139,8 @@ class PoolGradKernel : public framework::OpKernel<T> {
...
@@ -139,10 +139,8 @@ class PoolGradKernel : public framework::OpKernel<T> {
auto
&
dev_ctx
=
context
.
template
device_context
<
DeviceContext
>();
auto
&
dev_ctx
=
context
.
template
device_context
<
DeviceContext
>();
if
(
in_x_grad
)
{
if
(
in_x_grad
)
{
in_x_grad
->
mutable_data
<
T
>
(
context
.
GetPlace
());
in_x_grad
->
mutable_data
<
T
>
(
context
.
GetPlace
());
auto
temp
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
in_x_grad
);
paddle
::
operators
::
math
::
SetConstant
<
DeviceContext
,
T
>
set_constant
;
temp
.
device
(
set_constant
(
dev_ctx
,
in_x_grad
,
0.0
);
*
context
.
template
device_context
<
DeviceContext
>().
eigen_device
())
=
temp
.
constant
(
static_cast
<
T
>
(
0
));
switch
(
ksize
.
size
())
{
switch
(
ksize
.
size
())
{
case
2
:
{
case
2
:
{
...
...
python/paddle/v2/fluid/distribute_transpiler.py
浏览文件 @
cc82ff0d
...
@@ -225,7 +225,7 @@ class DistributeTranspiler:
...
@@ -225,7 +225,7 @@ class DistributeTranspiler:
if
len
(
splited_vars
)
<=
1
:
if
len
(
splited_vars
)
<=
1
:
continue
continue
orig_var
=
program
.
global_block
().
vars
[
varname
]
orig_var
=
program
.
global_block
().
vars
[
varname
]
if
orig_var
==
core
.
VarDesc
.
VarType
.
SELECTED_ROWS
:
if
orig_var
.
type
==
core
.
VarDesc
.
VarType
.
SELECTED_ROWS
:
height_sections
=
[]
height_sections
=
[]
for
v
in
splited_vars
:
for
v
in
splited_vars
:
height_sections
.
append
(
v
.
shape
[
0
])
height_sections
.
append
(
v
.
shape
[
0
])
...
@@ -234,7 +234,7 @@ class DistributeTranspiler:
...
@@ -234,7 +234,7 @@ class DistributeTranspiler:
inputs
=
{
"X"
:
orig_var
},
inputs
=
{
"X"
:
orig_var
},
outputs
=
{
"Out"
:
splited_vars
},
outputs
=
{
"Out"
:
splited_vars
},
attrs
=
{
"height_sections"
:
height_sections
})
attrs
=
{
"height_sections"
:
height_sections
})
elif
orig_var
==
core
.
VarDesc
.
VarType
.
LOD_TENSOR
:
elif
orig_var
.
type
==
core
.
VarDesc
.
VarType
.
LOD_TENSOR
:
sections
=
[]
sections
=
[]
for
v
in
splited_vars
:
for
v
in
splited_vars
:
sections
.
append
(
v
.
shape
[
0
])
sections
.
append
(
v
.
shape
[
0
])
...
...
python/paddle/v2/fluid/tests/book/test_
machine_translation_encoder_context
.py
→
python/paddle/v2/fluid/tests/book/test_
rnn_encoder_decoder
.py
浏览文件 @
cc82ff0d
...
@@ -118,12 +118,13 @@ def seq_to_seq_net():
...
@@ -118,12 +118,13 @@ def seq_to_seq_net():
src_forward
,
src_backward
=
bi_lstm_encoder
(
src_forward
,
src_backward
=
bi_lstm_encoder
(
input_seq
=
src_embedding
,
hidden_size
=
encoder_size
)
input_seq
=
src_embedding
,
hidden_size
=
encoder_size
)
encoded_vector
=
fluid
.
layers
.
concat
(
src_forward_last
=
fluid
.
layers
.
sequence_last_step
(
input
=
src_forward
)
input
=
[
src_forward
,
src_backward
],
axis
=
1
)
src_backward_first
=
fluid
.
layers
.
sequence_first_step
(
input
=
src_backward
)
enc_vec_last
=
fluid
.
layers
.
sequence_last_step
(
input
=
encoded_vector
)
encoded_vector
=
fluid
.
layers
.
concat
(
input
=
[
src_forward_last
,
src_backward_first
],
axis
=
1
)
decoder_boot
=
fluid
.
layers
.
fc
(
input
=
enc
_vec_last
,
decoder_boot
=
fluid
.
layers
.
fc
(
input
=
enc
oded_vector
,
size
=
decoder_size
,
size
=
decoder_size
,
bias_attr
=
False
,
bias_attr
=
False
,
act
=
'tanh'
)
act
=
'tanh'
)
...
@@ -137,7 +138,7 @@ def seq_to_seq_net():
...
@@ -137,7 +138,7 @@ def seq_to_seq_net():
dtype
=
'float32'
)
dtype
=
'float32'
)
prediction
=
lstm_decoder_without_attention
(
trg_embedding
,
decoder_boot
,
prediction
=
lstm_decoder_without_attention
(
trg_embedding
,
decoder_boot
,
enc
_vec_last
,
decoder_size
)
enc
oded_vector
,
decoder_size
)
label
=
fluid
.
layers
.
data
(
label
=
fluid
.
layers
.
data
(
name
=
'label_sequence'
,
shape
=
[
1
],
dtype
=
'int64'
,
lod_level
=
1
)
name
=
'label_sequence'
,
shape
=
[
1
],
dtype
=
'int64'
,
lod_level
=
1
)
cost
=
fluid
.
layers
.
cross_entropy
(
input
=
prediction
,
label
=
label
)
cost
=
fluid
.
layers
.
cross_entropy
(
input
=
prediction
,
label
=
label
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录