Skip to content

Commit

Permalink
fix: en_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yangguohao committed Sep 29, 2022
1 parent 43c6226 commit 518c53c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions python/paddle/nn/functional/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3477,8 +3477,7 @@ def multi_margin_loss(input,
reduction='mean',
name=None):
r"""
Measures a multi-class classification hinge loss (margin-based loss) between input :math:`input` (a 2D mini-batch `Tensor`, in shape (N, C),
where C is number of classes) and label :math:`label` (which is a 1D tensor of target class indices,:math:`0 \leq label \leq \text{C}-1`):
Measures a multi-class classification hinge loss between input :math:`input` and label :math:`label`:
For i-th mini-batch sample, the loss in terms of the 1D input :math:`input_i` and scalar
output :math:`label_i` is:
Expand Down
11 changes: 7 additions & 4 deletions python/paddle/nn/layer/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -1679,8 +1679,8 @@ def forward(self, input, positive, negative):


class MultiMarginLoss(Layer):
r"""Creates a criterion that optimizes a multi-class classification hinge loss (margin-based loss) between input :math:`input` (a 2D mini-batch `Tensor`, in shape (N, C),
where C is number of classes) and label :math:`label` (which is a 1D tensor of target class indices,:math:`0 \leq label \leq \text{C}-1`):
r"""Creates a criterion that optimizes a multi-class classification hinge loss (margin-based loss) between
input :math:`input` and label :math:`label`:
For i-th mini-batch sample, the loss in terms of the 1D input :math:`input_i` and scalar
output :math:`label_i` is:
Expand Down Expand Up @@ -1721,11 +1721,14 @@ class MultiMarginLoss(Layer):
Call parameters:
input (Tensor): Input tensor, the data type is float32 or float64.
label (Tensor): Label tensor, 0<= label < input.shape[1], the data type is int32 or int64.
Shape:
input: N-D Tensor, the shape is [N, C], N is batch size and `C` means number of classes.
label: N-D Tensor, the shape is [N,].
input: 2-D Tensor, the shape is [N, C], N is batch size and `C` means number of classes.
label: 1-D Tensor, the shape is [N,].
output: scalar. If :attr:`reduction` is ``'none'``, then same shape as the input.
Returns:
Expand Down

0 comments on commit 518c53c

Please sign in to comment.