Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
fbbac505
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看板
提交
fbbac505
编写于
6月 14, 2018
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix typos and format problems in smooth_l1's doc
上级
8f266e20
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+12
-12
未找到文件。
python/paddle/fluid/layers/nn.py
浏览文件 @
fbbac505
...
@@ -3411,31 +3411,30 @@ def softmax_with_cross_entropy(logits, label, soft_label=False):
...
@@ -3411,31 +3411,30 @@ def softmax_with_cross_entropy(logits, label, soft_label=False):
def
smooth_l1
(
x
,
y
,
inside_weight
=
None
,
outside_weight
=
None
,
sigma
=
None
):
def
smooth_l1
(
x
,
y
,
inside_weight
=
None
,
outside_weight
=
None
,
sigma
=
None
):
"""
"""
**Smooth L1 Loss Operator. **
This layer computes the smooth L1 loss for Variable `x` and `y`.
It takes the first dimension of `x` and `y` as batch size.
This operator computes the smooth L1 loss for X and Y.
The operator takes the first dimension of X and Y as batch size.
For each instance, it computes the smooth L1 loss element by element first
For each instance, it computes the smooth L1 loss element by element first
and then sums all the losses. So the shape of Out is [batch_size, 1].
and then sums all the losses. So the shape of ouput Variable is
[batch_size, 1].
Args:
Args:
x (Variable): A tensor with rank at least 2. The input value of smooth
x (Variable): A tensor with rank at least 2. The input value of smooth
L1 loss op with shape [batch_size, dim1, ..., dimN].
L1 loss op with shape [batch_size, dim1, ..., dimN].
y (Variable): A tensor with rank at least 2. The target value of smooth
y (Variable): A tensor with rank at least 2. The target value of smooth
L1 loss op with same shape as
x
.
L1 loss op with same shape as
`x`
.
inside_weight (Variable|None): A tensor with rank at least 2. This
inside_weight (Variable|None): A tensor with rank at least 2. This
input is optional and should have same shape with
x
. If provided,
input is optional and should have same shape with
`x`
. If provided,
the result of (
x - y
) will be multiplied by this tensor element by
the result of (
`x - y`
) will be multiplied by this tensor element by
element.
element.
outside_weight (Variable|None): A tensor with rank at least 2. This
outside_weight (Variable|None): A tensor with rank at least 2. This
input is optional and should have same shape with x. If provided,
input is optional and should have same shape with x. If provided,
the out smooth L1 loss will be multiplied by this tensor element
the out smooth L1 loss will be multiplied by this tensor element
by element.
by element.
sigma (float|None): Hyper parameter of smooth L1 loss op. A float scalar
sigma (float|None): Hyper parameter of smooth L1 loss layer. A float
with default value 1.0.
scalar with default value 1.0.
Returns:
Returns:
Variable: A tensor with rank be 2. The output smooth L1 loss with
Variable: The output smooth L1 loss with shape [batch_size, 1].
shape [batch_size, 1].
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -3446,6 +3445,7 @@ def smooth_l1(x, y, inside_weight=None, outside_weight=None, sigma=None):
...
@@ -3446,6 +3445,7 @@ def smooth_l1(x, y, inside_weight=None, outside_weight=None, sigma=None):
fc = fluid.layers.fc(input=data, size=100)
fc = fluid.layers.fc(input=data, size=100)
out = fluid.layers.smooth_l1(x=fc, y=label)
out = fluid.layers.smooth_l1(x=fc, y=label)
"""
"""
helper
=
LayerHelper
(
'smooth_l1_loss'
,
**
locals
())
helper
=
LayerHelper
(
'smooth_l1_loss'
,
**
locals
())
diff
=
helper
.
create_tmp_variable
(
dtype
=
x
.
dtype
)
diff
=
helper
.
create_tmp_variable
(
dtype
=
x
.
dtype
)
loss
=
helper
.
create_tmp_variable
(
dtype
=
x
.
dtype
)
loss
=
helper
.
create_tmp_variable
(
dtype
=
x
.
dtype
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录