Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
756af4e7
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看板
提交
756af4e7
编写于
9月 22, 2017
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
regulate comments in margin_rank_loss_op
上级
6b3e9ccb
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
7 addition
and
7 deletion
+7
-7
paddle/operators/margin_rank_loss_op.cc
paddle/operators/margin_rank_loss_op.cc
+6
-6
python/paddle/v2/framework/tests/test_margin_rank_loss_op.py
python/paddle/v2/framework/tests/test_margin_rank_loss_op.py
+1
-1
未找到文件。
paddle/operators/margin_rank_loss_op.cc
浏览文件 @
756af4e7
...
...
@@ -45,8 +45,8 @@ class MarginRankLossOpMaker : public framework::OpProtoAndCheckerMaker {
MarginRankLossOpMaker
(
framework
::
OpProto
*
proto
,
framework
::
OpAttrChecker
*
op_checker
)
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
AddInput
(
"X1"
,
"The first
input of MarginRankLossOp
, row vector."
);
AddInput
(
"X2"
,
"The second
input of MarginRankLossOp
, row vector."
);
AddInput
(
"X1"
,
"The first
variable to be ranked
, row vector."
);
AddInput
(
"X2"
,
"The second
variable to be ranked
, row vector."
);
AddInput
(
"Label"
,
"The label indicating X1 ranked higher than X2 "
"or not, row vector."
);
...
...
@@ -54,16 +54,16 @@ class MarginRankLossOpMaker : public framework::OpProtoAndCheckerMaker {
.
SetDefault
(
0
);
AddOutput
(
"Activated"
,
"Intermediate tensor to indicate whether each element of "
"Output(Out) is activated"
)
"Output(Out) is activated
.
"
)
.
AsIntermediate
();
AddOutput
(
"Out"
,
"The output loss of MarginRankLoss operator"
);
AddComment
(
R"DOC(
MarginRankLoss operator measures the loss given a pair of input {`X1`, `X2`}
and
`Label` with attribuute `margin`, where `Label =
= 1` indicating X1 is
ranked higher than `X2`, otherwise `Label =
=
-1`. The loss turns out
and
the `Label` with attribute `margin`, where `Label
= 1` indicating X1 is
ranked higher than `X2`, otherwise `Label = -1`. The loss turns out
loss(X1, X2, Label) = max(0, -Label * (X1
-
X2) + margin)
loss(X1, X2, Label) = max(0, -Label * (X1
-
X2) + margin)
For batch input, `X1`, `X2` and `Label` all have the same size batch_size x 1.
...
...
python/paddle/v2/framework/tests/test_margin_rank_loss_op.py
浏览文件 @
756af4e7
...
...
@@ -7,7 +7,7 @@ class TestMarginRankLossOp(OpTest):
def
setUp
(
self
):
self
.
op_type
=
"margin_rank_loss"
batch_size
=
5
margin
=
0.
1
margin
=
0.
5
# labels_{i} = {-1, 1}
label
=
2
*
np
.
random
.
randint
(
0
,
2
,
size
=
(
batch_size
,
1
)).
astype
(
"float32"
)
-
1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录