Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
3e85dbb6
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3e85dbb6
编写于
2月 11, 2023
作者:
C
cyber-pioneer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add dropout op map
上级
4b8b4c71
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
14 deletion
+45
-14
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+30
-11
python/paddle/incubate/autograd/primx.py
python/paddle/incubate/autograd/primx.py
+6
-0
python/paddle/incubate/autograd/utils.py
python/paddle/incubate/autograd/utils.py
+9
-3
未找到文件。
paddle/phi/api/yaml/op_compat.yaml
浏览文件 @
3e85dbb6
...
@@ -414,6 +414,17 @@
...
@@ -414,6 +414,17 @@
-
op
:
dropout
-
op
:
dropout
backward
:
dropout_grad
backward
:
dropout_grad
inputs
:
x
:
X
outputs
:
out
:
Out
mask
:
Mask
attrs
:
p
:
dropout_prob
is_test
:
is_test
mode
:
dropout_implementation
seed
:
seed
fix_seed
:
fix_seed
extra
:
extra
:
attrs
:
[
bool fix_seed = false
,
int seed = 0
]
attrs
:
[
bool fix_seed = false
,
int seed = 0
]
...
@@ -790,6 +801,14 @@
...
@@ -790,6 +801,14 @@
-
op
:
layer_norm
-
op
:
layer_norm
backward
:
layer_norm_grad
backward
:
layer_norm_grad
inputs
:
x
:
X
scale
:
Scale
bias
:
Bias
outputs
:
out
:
Y
mean
:
Mean
variance
:
Variance
extra
:
extra
:
attrs
:
[
bool use_mkldnn = false
,
str mkldnn_data_type = "float32"
,
bool is_test = false
]
attrs
:
[
bool use_mkldnn = false
,
str mkldnn_data_type = "float32"
,
bool is_test = false
]
...
@@ -940,6 +959,17 @@
...
@@ -940,6 +959,17 @@
outputs
:
outputs
:
out
:
Out
out
:
Out
-
op
:
mean (reduce_mean)
backward
:
reduce_mean_grad
inputs
:
x
:
X
outputs
:
out
:
Out
attrs
:
{
axis
:
dim
,
keepdim
:
keep_dim
}
extra
:
attrs
:
[
bool use_mkldnn = false
]
-
op
:
meshgrid
-
op
:
meshgrid
backward
:
meshgrid_grad
backward
:
meshgrid_grad
inputs
:
inputs
:
...
@@ -1145,17 +1175,6 @@
...
@@ -1145,17 +1175,6 @@
extra
:
extra
:
attrs
:
[
bool use_mkldnn = false
]
attrs
:
[
bool use_mkldnn = false
]
-
op
:
mean (reduce_mean)
backward
:
reduce_mean_grad
inputs
:
x
:
X
outputs
:
out
:
Out
attrs
:
{
axis
:
dim
,
keepdim
:
keep_dim
}
extra
:
attrs
:
[
bool use_mkldnn = false
]
-
op
:
reduce_min
-
op
:
reduce_min
backward
:
reduce_min_grad
backward
:
reduce_min_grad
extra
:
extra
:
...
...
python/paddle/incubate/autograd/primx.py
浏览文件 @
3e85dbb6
...
@@ -597,11 +597,13 @@ def _lower_composite(block, blacklist=[]):
...
@@ -597,11 +597,13 @@ def _lower_composite(block, blacklist=[]):
# if output var of composite rule is None, this means this var is not needed
# if output var of composite rule is None, this means this var is not needed
none_vars_to_remove
=
set
()
none_vars_to_remove
=
set
()
change
=
None
# Step2: Process all ops in the target block
# Step2: Process all ops in the target block
for
op_idx
in
range
(
len
(
block
.
ops
)):
for
op_idx
in
range
(
len
(
block
.
ops
)):
op
=
block
.
ops
[
op_idx
]
op
=
block
.
ops
[
op_idx
]
ops_to_remove
.
append
(
op_idx
)
ops_to_remove
.
append
(
op_idx
)
if
lookup_fn
(
op
.
type
)
is
not
None
and
op
.
type
not
in
blacklist
:
if
lookup_fn
(
op
.
type
)
is
not
None
and
op
.
type
not
in
blacklist
:
change
=
True
input_args
=
prepare_python_api_arguments
(
op
)
input_args
=
prepare_python_api_arguments
(
op
)
bind
(
input_args
,
to_bind
,
value_table
)
bind
(
input_args
,
to_bind
,
value_table
)
...
@@ -681,6 +683,10 @@ def _lower_composite(block, blacklist=[]):
...
@@ -681,6 +683,10 @@ def _lower_composite(block, blacklist=[]):
block
.
desc
.
_remove_var
(
var_name
.
encode
())
block
.
desc
.
_remove_var
(
var_name
.
encode
())
del
block
.
vars
[
var_name
]
del
block
.
vars
[
var_name
]
block
.
_sync_with_cpp
()
block
.
_sync_with_cpp
()
# composite ops may contain other ops, thus, call _lower_composite again.
if
change
:
_lower_composite
(
block
,
blacklist
)
return
return
elif
isinstance
(
block
,
typing
.
Sequence
):
elif
isinstance
(
block
,
typing
.
Sequence
):
...
...
python/paddle/incubate/autograd/utils.py
浏览文件 @
3e85dbb6
...
@@ -232,14 +232,20 @@ def get_output_vars_from_comosite(op):
...
@@ -232,14 +232,20 @@ def get_output_vars_from_comosite(op):
origin_output_name
=
op_map
[
name
][
"outputs"
][
item
]
origin_output_name
=
op_map
[
name
][
"outputs"
][
item
]
if
origin_output_name
not
in
origin_output_names
:
if
origin_output_name
not
in
origin_output_names
:
continue
continue
origin_output_var
=
get_var_block
(
op
.
block
,
op
.
output
(
origin_output_name
))
origin_output_var
=
get_var_block
(
op
.
block
,
op
.
output
(
origin_output_name
)
)
res
.
append
(
origin_output_var
)
res
.
append
(
origin_output_var
)
elif
len
(
origin_output_names
)
==
1
:
elif
len
(
origin_output_names
)
==
1
:
# When origin output num is 1, map info is not needed.
# When origin output num is 1, map info is not needed.
origin_output_var
=
get_var_block
(
op
.
block
,
op
.
output
(
origin_output_names
[
0
]))
origin_output_var
=
get_var_block
(
op
.
block
,
op
.
output
(
origin_output_names
[
0
])
)
res
.
append
(
origin_output_var
)
res
.
append
(
origin_output_var
)
else
:
else
:
raise
ValueError
(
"When replace op with composite rule, there must exist output map info from origin op to composite rule."
)
raise
ValueError
(
"When replace op with composite rule, there must exist output map info from origin op to composite rule."
)
return
res
return
res
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录