Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
2f56d4b3
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看板
提交
2f56d4b3
编写于
12月 19, 2017
作者:
Y
Yang Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
forward pass compile time
上级
b2ee9190
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
4 deletion
+41
-4
paddle/operators/parallel_do_op.cc
paddle/operators/parallel_do_op.cc
+4
-2
python/paddle/v2/fluid/framework.py
python/paddle/v2/fluid/framework.py
+2
-1
python/paddle/v2/fluid/layers/control_flow.py
python/paddle/v2/fluid/layers/control_flow.py
+2
-1
python/paddle/v2/fluid/tests/test_parallel_op.py
python/paddle/v2/fluid/tests/test_parallel_op.py
+33
-0
未找到文件。
paddle/operators/parallel_do_op.cc
浏览文件 @
2f56d4b3
...
@@ -23,9 +23,11 @@ namespace operators {
...
@@ -23,9 +23,11 @@ namespace operators {
constexpr
char
kInputs
[]
=
"inputs"
;
constexpr
char
kInputs
[]
=
"inputs"
;
constexpr
char
kParameters
[]
=
"parameters"
;
constexpr
char
kParameters
[]
=
"parameters"
;
constexpr
char
kPlaces
[]
=
"places"
;
constexpr
char
kPlaces
[]
=
"places"
;
constexpr
char
kParallelBlock
[]
=
"sub_block"
;
constexpr
char
kOutputs
[]
=
"outputs"
;
constexpr
char
kOutputs
[]
=
"outputs"
;
constexpr
char
kParallelScopes
[]
=
"sub_scopes"
;
constexpr
char
kParallelScopes
[]
=
"parallel_scopes"
;
constexpr
char
kParallelBlock
[]
=
"sub_block"
;
// #define GRAD_SUFFIX "@GRAD"
// #define GRAD_SUFFIX "@GRAD"
// constexpr char kInputGrads[] = "inputs" GRAD_SUFFIX;
// constexpr char kInputGrads[] = "inputs" GRAD_SUFFIX;
// constexpr char kOutputGrads[] = "outputs" GRAD_SUFFIX;
// constexpr char kOutputGrads[] = "outputs" GRAD_SUFFIX;
...
...
python/paddle/v2/fluid/framework.py
浏览文件 @
2f56d4b3
...
@@ -424,7 +424,8 @@ class Operator(object):
...
@@ -424,7 +424,8 @@ class Operator(object):
self
.
desc
.
check_attrs
()
self
.
desc
.
check_attrs
()
no_kernel_op_set
=
{
no_kernel_op_set
=
{
'feed'
,
'fetch'
,
'save'
,
'load'
,
'recurrent'
,
'feed'
,
'fetch'
,
'save'
,
'load'
,
'recurrent'
,
'rnn_memory_helper_grad'
,
'conditional_block'
,
'while'
'rnn_memory_helper_grad'
,
'conditional_block'
,
'while'
,
'parallel_do'
}
}
if
type
not
in
no_kernel_op_set
:
if
type
not
in
no_kernel_op_set
:
self
.
desc
.
infer_var_type
(
self
.
block
.
desc
)
self
.
desc
.
infer_var_type
(
self
.
block
.
desc
)
...
...
python/paddle/v2/fluid/layers/control_flow.py
浏览文件 @
2f56d4b3
...
@@ -103,6 +103,7 @@ class ParallelDo(object):
...
@@ -103,6 +103,7 @@ class ParallelDo(object):
def
read_input
(
self
,
var
):
def
read_input
(
self
,
var
):
self
.
inputs
.
append
(
var
)
self
.
inputs
.
append
(
var
)
return
var
def
write_output
(
self
,
var
):
def
write_output
(
self
,
var
):
self
.
outputs
.
append
(
var
)
self
.
outputs
.
append
(
var
)
...
@@ -149,7 +150,7 @@ class ParallelDo(object):
...
@@ -149,7 +150,7 @@ class ParallelDo(object):
'places'
:
self
.
places
'places'
:
self
.
places
},
},
outputs
=
{
'outputs'
:
self
.
outputs
,
outputs
=
{
'outputs'
:
self
.
outputs
,
'
step
_scopes'
:
[
step_scope
]},
'
parallel
_scopes'
:
[
step_scope
]},
attrs
=
{
'sub_block'
:
current_block
})
attrs
=
{
'sub_block'
:
current_block
})
...
...
python/paddle/v2/fluid/tests/test_parallel_op.py
0 → 100644
浏览文件 @
2f56d4b3
import
unittest
import
paddle.v2.fluid.layers
as
layers
import
paddle.v2.fluid
as
fluid
from
paddle.v2.fluid.framework
import
Program
from
paddle.v2.fluid.executor
import
Executor
from
paddle.v2.fluid.backward
import
append_backward_ops
import
numpy
as
np
import
paddle.v2.fluid.core
as
core
class
ParallelOpTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
x
=
layers
.
data
(
shape
=
[
2
,
3
,
4
],
dtype
=
'float32'
,
name
=
'x'
,
append_batch_size
=
False
)
places
=
fluid
.
default_main_program
().
global_block
().
create_var
()
pd
=
layers
.
ParallelDo
(
places
=
places
)
with
pd
.
do
():
data
=
pd
.
read_input
(
x
)
hidden
=
layers
.
fc
(
input
=
data
,
size
=
7
)
pd
.
write_output
(
hidden
)
data
=
pd
()
print
data
print
fluid
.
default_main_program
()
def
test_forward
(
self
):
pass
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录