Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
13e254fa
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
13e254fa
编写于
11月 20, 2018
作者:
J
jerrywgz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code, test=develop
上级
79cec531
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
5 addition
and
16 deletion
+5
-16
paddle/fluid/API.spec
paddle/fluid/API.spec
+1
-1
paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc
...e/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc
+2
-2
paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.h
...le/fluid/operators/sigmoid_cross_entropy_with_logits_op.h
+0
-10
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+1
-1
python/paddle/fluid/tests/unittests/test_layers.py
python/paddle/fluid/tests/unittests/test_layers.py
+1
-1
python/paddle/fluid/tests/unittests/test_sigmoid_cross_entropy_with_logits_op.py
...ts/unittests/test_sigmoid_cross_entropy_with_logits_op.py
+0
-1
未找到文件。
paddle/fluid/API.spec
浏览文件 @
13e254fa
...
...
@@ -174,7 +174,7 @@ paddle.fluid.layers.clip ArgSpec(args=['x', 'min', 'max', 'name'], varargs=None,
paddle.fluid.layers.clip_by_norm ArgSpec(args=['x', 'max_norm', 'name'], varargs=None, keywords=None, defaults=(None,))
paddle.fluid.layers.mean ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,))
paddle.fluid.layers.mul ArgSpec(args=['x', 'y', 'x_num_col_dims', 'y_num_col_dims', 'name'], varargs=None, keywords=None, defaults=(1, 1, None))
paddle.fluid.layers.sigmoid_cross_entropy_with_logits ArgSpec(args=['x', 'label', '
name'], varargs=None, keywords=None, defaults=(None,
))
paddle.fluid.layers.sigmoid_cross_entropy_with_logits ArgSpec(args=['x', 'label', '
ignore_index', 'name'], varargs=None, keywords=None, defaults=(-100, None
))
paddle.fluid.layers.maxout ArgSpec(args=['x', 'groups', 'name'], varargs=None, keywords=None, defaults=(None,))
paddle.fluid.layers.space_to_depth ArgSpec(args=['x', 'blocksize', 'name'], varargs=None, keywords=None, defaults=(None,))
paddle.fluid.layers.affine_grid ArgSpec(args=['theta', 'out_shape', 'name'], varargs=None, keywords=None, defaults=(None,))
...
...
paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc
浏览文件 @
13e254fa
...
...
@@ -102,9 +102,9 @@ class SigmoidCrossEntropyWithLogitsOpMaker
" of elementwise logistic losses."
);
AddAttr
<
int
>
(
"ignore_index"
,
"(int, default -1), Specifies a target value that is ignored and"
"(int, default -1
00
), Specifies a target value that is ignored and"
"does not contribute to the input gradient."
)
.
SetDefault
(
-
1
);
.
SetDefault
(
-
1
00
);
AddComment
(
R"DOC(
SigmoidCrossEntropyWithLogits Operator.
...
...
paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.h
浏览文件 @
13e254fa
...
...
@@ -31,7 +31,6 @@ using EigenMatrix = framework::EigenMatrix<T, MajorType, IndexType>;
template
<
typename
T
>
struct
SigmoidCrossEntropyWithLogitsForward
{
// EIGEN_EMPTY_STRUCT_CTOR(SigmoidCrossEntropyWithLogitsForward)
HOSTDEVICE
SigmoidCrossEntropyWithLogitsForward
(
const
int
&
ignore_index
)
:
ignore_index
(
ignore_index
)
{}
...
...
@@ -50,7 +49,6 @@ struct SigmoidCrossEntropyWithLogitsForward {
template
<
typename
T
>
struct
SigmoidCrossEntropyWithLogitsBackward
{
// EIGEN_EMPTY_STRUCT_CTOR(SigmoidCrossEntropyWithLogitsForward)
HOSTDEVICE
SigmoidCrossEntropyWithLogitsBackward
(
const
int
&
ignore_index
)
:
ignore_index
(
ignore_index
)
{}
...
...
@@ -83,14 +81,6 @@ class SigmoidCrossEntropyWithLogitsKernel : public framework::OpKernel<T> {
out
.
device
(
place
)
=
x
.
binaryExpr
(
labels
,
SigmoidCrossEntropyWithLogitsForward
<
T
>
(
ignore_index
));
// term1 = max(x, 0)
// auto term1 = x.cwiseMax(static_cast<T>(0));
// term2 = x * labels
// auto term2 = x * labels;
// term3 = log(1 + exp(-abs(x)))
// auto term3 = (static_cast<T>(1) + (-(x.abs())).exp()).log();
// out.device(place) = term1 - term2 + term3;
}
};
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
13e254fa
...
...
@@ -7892,7 +7892,7 @@ def mul(x, y, x_num_col_dims=1, y_num_col_dims=1, name=None):
@
templatedoc
()
def
sigmoid_cross_entropy_with_logits
(
x
,
label
,
ignore_index
=-
1
,
name
=
None
):
def
sigmoid_cross_entropy_with_logits
(
x
,
label
,
ignore_index
=-
1
00
,
name
=
None
):
"""
${comment}
...
...
python/paddle/fluid/tests/unittests/test_layers.py
浏览文件 @
13e254fa
...
...
@@ -173,7 +173,7 @@ class TestBook(unittest.TestCase):
ignore_index
=
-
1
self
.
assertIsNotNone
(
layers
.
sigmoid_cross_entropy_with_logits
(
x
=
dat
,
label
=
lbl
,
ignore_index
=
-
1
))
x
=
dat
,
label
=
lbl
,
ignore_index
=
ignore_index
))
print
(
str
(
program
))
def
test_hsigmoid
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_sigmoid_cross_entropy_with_logits_op.py
浏览文件 @
13e254fa
...
...
@@ -119,4 +119,3 @@ class TestSigmoidCrossEntropyWithLogitsOp3(OpTest):
if
__name__
==
'__main__'
:
unittest
.
main
()
np
.
random
.
seed
(
0
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录