Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
674327a4
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
674327a4
编写于
6月 13, 2018
作者:
Y
yuyang18
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish several API
上级
ce6394ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
23 deletion
+46
-23
paddle/fluid/operators/activation_op.cc
paddle/fluid/operators/activation_op.cc
+2
-1
python/paddle/fluid/layers/detection.py
python/paddle/fluid/layers/detection.py
+19
-19
python/paddle/fluid/layers/ops.py
python/paddle/fluid/layers/ops.py
+25
-3
未找到文件。
paddle/fluid/operators/activation_op.cc
浏览文件 @
674327a4
...
...
@@ -271,7 +271,8 @@ class HardShrinkOpMaker : public framework::OpProtoAndCheckerMaker {
void
Make
()
override
{
AddInput
(
"X"
,
"Input of HardShrink operator"
);
AddOutput
(
"Out"
,
"Output of HardShrink operator"
);
AddAttr
<
float
>
(
"threshold"
,
"The value of threshold for HardShrink"
)
AddAttr
<
float
>
(
"threshold"
,
"The value of threshold for HardShrink. [default: 0.5]"
)
.
SetDefault
(
0.5
f
);
AddComment
(
R"DOC(
HardShrink Activation Operator.
...
...
python/paddle/fluid/layers/detection.py
浏览文件 @
674327a4
...
...
@@ -403,25 +403,6 @@ def ssd_loss(location,
5.3 Compute the overall weighted loss.
>>> import paddle.fluid.layers as layers
>>> pb = layers.data(
>>> name='prior_box',
>>> shape=[10, 4],
>>> append_batch_size=False,
>>> dtype='float32')
>>> pbv = layers.data(
>>> name='prior_box_var',
>>> shape=[10, 4],
>>> append_batch_size=False,
>>> dtype='float32')
>>> loc = layers.data(name='target_box', shape=[10, 4], dtype='float32')
>>> scores = layers.data(name='scores', shape=[10, 21], dtype='float32')
>>> gt_box = layers.data(
>>> name='gt_box', shape=[4], lod_level=1, dtype='float32')
>>> gt_label = layers.data(
>>> name='gt_label', shape=[1], lod_level=1, dtype='float32')
>>> loss = layers.ssd_loss(loc, scores, gt_box, gt_label, pb, pbv)
Args:
location (Variable): The location predictions are a 3D Tensor with
shape [N, Np, 4], N is the batch size, Np is total number of
...
...
@@ -465,6 +446,25 @@ def ssd_loss(location,
Raises:
ValueError: If mining_type is 'hard_example', now only support mining
\
type of `max_negative`.
Examples:
>>> pb = fluid.layers.data(
>>> name='prior_box',
>>> shape=[10, 4],
>>> append_batch_size=False,
>>> dtype='float32')
>>> pbv = fluid.layers.data(
>>> name='prior_box_var',
>>> shape=[10, 4],
>>> append_batch_size=False,
>>> dtype='float32')
>>> loc = fluid.layers.data(name='target_box', shape=[10, 4], dtype='float32')
>>> scores = fluid.layers.data(name='scores', shape=[10, 21], dtype='float32')
>>> gt_box = fluid.layers.data(
>>> name='gt_box', shape=[4], lod_level=1, dtype='float32')
>>> gt_label = fluid.layers.data(
>>> name='gt_label', shape=[1], lod_level=1, dtype='float32')
>>> loss = fluid.layers.ssd_loss(loc, scores, gt_box, gt_label, pb, pbv)
"""
helper
=
LayerHelper
(
'ssd_loss'
,
**
locals
())
...
...
python/paddle/fluid/layers/ops.py
浏览文件 @
674327a4
...
...
@@ -40,7 +40,6 @@ __activations__ = [
'relu6'
,
'pow'
,
'stanh'
,
'hard_shrink'
,
'thresholded_relu'
,
'hard_sigmoid'
,
'swish'
,
...
...
@@ -92,9 +91,32 @@ def uniform_random(shape, dtype=None, min=None, max=None, seed=None):
kwargs
[
name
]
=
val
return
_uniform_random_
(
**
kwargs
)
uniform_random
.
__doc__
=
_uniform_random_
.
__doc__
+
"
\n
"
\
+
"""
uniform_random
.
__doc__
=
_uniform_random_
.
__doc__
+
"
\n
"
\
+
"""
Examples:
>>> result = fluid.layers.uniform_random(shape=[32, 784])
"""
__all__
+=
[
'hard_shrink'
]
_hard_shrink_
=
generate_layer_fn
(
'hard_shrink'
)
def
hard_shrink
(
x
,
threshold
=
None
):
kwargs
=
dict
()
for
name
in
locals
():
val
=
locals
()[
name
]
if
val
is
not
None
:
kwargs
[
name
]
=
val
return
_hard_shrink_
(
**
kwargs
)
hard_shrink
.
__doc__
=
_hard_shrink_
.
__doc__
+
"
\n
"
\
+
"""
Examples:
>>> data = fluid.layers.data(name="input", shape=[784])
>>> result = fluid.layers.hard_shrink(x=data, threshold=0.3)
"""
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录