Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
2beb6eac
P
Paddle
项目概览
机器未来
/
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看板
未验证
提交
2beb6eac
编写于
4月 12, 2020
作者:
Z
zhongpu
提交者:
GitHub
4月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix if logic in dygraph (#23728)
* fix if logic in dygraph, test=develop * fix bug, test=develop
上级
dfe2f949
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
44 deletion
+13
-44
python/paddle/fluid/dygraph/layer_object_helper.py
python/paddle/fluid/dygraph/layer_object_helper.py
+0
-32
python/paddle/fluid/dygraph_utils.py
python/paddle/fluid/dygraph_utils.py
+1
-1
python/paddle/fluid/layers/detection.py
python/paddle/fluid/layers/detection.py
+12
-11
未找到文件。
python/paddle/fluid/dygraph/layer_object_helper.py
浏览文件 @
2beb6eac
...
...
@@ -135,38 +135,6 @@ class LayerObjectHelper(LayerHelperBase):
(
name
,
self
.
name
))
return
param
def
append_bias_op
(
self
,
input_var
,
dim_start
=
1
,
dim_end
=
None
,
bias_attr
=
None
):
"""Append bias operator and return its output. If the user does not set bias_attr, append_bias_op will return input_var
Args:
input_var: the input variable. The len(input_var.shape) is
larger or equal than 2.
dim_start:
dim_end: the shape of the bias will be
bias_attr: the bias_attr of it
Return the Variable of after append bias op
"""
size
=
list
(
input_var
.
shape
[
dim_start
:
dim_end
])
bias_attr
=
bias_attr
if
not
bias_attr
:
return
input_var
b
=
self
.
create_parameter
(
attr
=
bias_attr
,
shape
=
size
,
dtype
=
input_var
.
dtype
,
is_bias
=
True
)
tmp
=
self
.
create_variable_for_type_inference
(
dtype
=
input_var
.
dtype
)
self
.
append_op
(
type
=
'elementwise_add'
,
inputs
=
{
'X'
:
[
input_var
],
'Y'
:
[
b
]},
outputs
=
{
'Out'
:
[
tmp
]},
attrs
=
{
'axis'
:
dim_start
})
return
tmp
# TODO: this should not be called anymore after all activation func move to Layers
def
append_activation
(
self
,
input_var
,
...
...
python/paddle/fluid/dygraph_utils.py
浏览文件 @
2beb6eac
...
...
@@ -31,7 +31,7 @@ def _append_activation_in_dygraph(input,
Return the Variable after append activation
"""
if
not
act
:
if
act
is
None
:
return
input
attrs
=
()
...
...
python/paddle/fluid/layers/detection.py
浏览文件 @
2beb6eac
...
...
@@ -1167,15 +1167,16 @@ def detection_map(detect_res,
return
helper
.
create_variable_for_type_inference
(
dtype
=
type
)
map_out
=
__create_var
(
'float32'
)
accum_pos_count_out
=
out_states
[
0
]
if
out_states
else
__create_var
(
'int32'
)
accum_true_pos_out
=
out_states
[
1
]
if
out_states
else
__create_var
(
'float32'
)
accum_false_pos_out
=
out_states
[
2
]
if
out_states
else
__create_var
(
'float32'
)
accum_pos_count_out
=
out_states
[
0
]
if
out_states
is
not
None
else
__create_var
(
'int32'
)
accum_true_pos_out
=
out_states
[
1
]
if
out_states
is
not
None
else
__create_var
(
'float32'
)
accum_false_pos_out
=
out_states
[
2
]
if
out_states
is
not
None
else
__create_var
(
'float32'
)
pos_count
=
input_states
[
0
]
if
input_states
else
None
true_pos
=
input_states
[
1
]
if
input_states
else
None
false_pos
=
input_states
[
2
]
if
input_states
else
None
pos_count
=
input_states
[
0
]
if
input_states
is
not
None
else
None
true_pos
=
input_states
[
1
]
if
input_states
is
not
None
else
None
false_pos
=
input_states
[
2
]
if
input_states
is
not
None
else
None
helper
.
append_op
(
type
=
"detection_map"
,
...
...
@@ -2167,17 +2168,17 @@ def multi_box_head(inputs,
aspect_ratios
,
num_layer
,
'aspect_ratios should be list or tuple, and the length of inputs '
'and aspect_ratios should be the same.'
)
if
step_h
:
if
step_h
is
not
None
:
_is_list_or_tuple_and_equal
(
step_h
,
num_layer
,
'step_h should be list or tuple, and the length of inputs and '
'step_h should be the same.'
)
if
step_w
:
if
step_w
is
not
None
:
_is_list_or_tuple_and_equal
(
step_w
,
num_layer
,
'step_w should be list or tuple, and the length of inputs and '
'step_w should be the same.'
)
if
steps
:
if
steps
is
not
None
:
_is_list_or_tuple_and_equal
(
steps
,
num_layer
,
'steps should be list or tuple, and the length of inputs and '
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录