提交 7f6ff6f5 编写于 作者: M minqiyang

Polish doc

test=develop
上级 35e547e0
...@@ -5830,25 +5830,31 @@ def rank_loss(label, left, right, name=None): ...@@ -5830,25 +5830,31 @@ def rank_loss(label, left, right, name=None):
def margin_rank_loss(label, left, right, margin=0.1, name=None): def margin_rank_loss(label, left, right, margin=0.1, name=None):
""" """
**Margin Rank loss layer for rank problem** Margin Rank loss layer for rank problem, which comparing left value and right value be passed in.
Args: The rank loss can be defined as below equation:
label (Variable): Indicats whether left higher than (right + margin) or not.
left (Variable): rank score for left. .. math::
right (Variable): rank score for right.
margin (float): Indicates the margin to be added to right rank\_loss &= max(0, -label * (left - right) + margin)
name (str|None): A name for this layer (optional). If set None, the layer
will be named automatically. Args:
Returns: label (Variable): Indicats whether left higher than (right + margin) or not.
list: The value of rank loss. left (Variable): rank score for left.
Raises: right (Variable): rank score for right.
ValueError: Any of label, left, and right is not a variable. margin (float): Indicates the margin to be added to right
Examples: name (str|None): A name for this layer (optional). If set None, the layer
.. code-block:: python will be named automatically.
label = fluid.layers.data(name="label", shape=[4, 1], dtype="float32") Returns:
left = fluid.layers.data(name="left", shape=[4, 1], dtype="float32") list: The value of rank loss.
right = fluid.layers.data(name="right", shape=[4, 1], dtype="float32") Raises:
out = fluid.layers.margin_rank_loss(label, left, right) ValueError: Any of label, left, and right is not a variable.
""" Examples:
.. code-block:: python
label = fluid.layers.data(name="label", shape=[4, 1], dtype="float32")
left = fluid.layers.data(name="left", shape=[4, 1], dtype="float32")
right = fluid.layers.data(name="right", shape=[4, 1], dtype="float32")
out = fluid.layers.margin_rank_loss(label, left, right)
"""
helper = LayerHelper('margin_rank_loss', **locals()) helper = LayerHelper('margin_rank_loss', **locals())
if not (isinstance(label, Variable)): if not (isinstance(label, Variable)):
raise ValueError("The label should be a Variable") raise ValueError("The label should be a Variable")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册