!46152 修复Smooth l1 loss API文档

Merge pull request !46152 from 刘崇鸣/fix_smooth_l1_loss_doc
This commit is contained in:
i-robot 2022-11-29 09:09:11 +00:00 committed by Gitee
commit c24d7910f6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 7 deletions

View File

@ -25,12 +25,12 @@ mindspore.ops.smooth_l1_loss
\operatorname{sum}(L_{i}), & \text{if reduction} = \text{'sum'.}
\end{cases}
其中, :math:`\text{beta}` 控制损失函数从二次元变为线性的point。默认值是1.0。 :math:`N` 为batch size。
其中, :math:`\text{beta}` 控制损失函数在线性与二次间变换的阈值, :math:`\text{beta}>0` 默认值是1.0。 :math:`N` 为batch size。
参数:
- **logits** (Tensor) - shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。数据类型为float16float32和float64。
- **labels** (Tensor) - shape :math:`(N, *)` ,与 `logits` 的shape和数据类型相同。
- **beta** (float) - 控制损失函数在L1Loss和L2Loss间变换的阈值。默认值1.0。
- **beta** (float) - 控制损失函数在L1Loss和L2Loss间变换的阈值该值必须大于0。默认值1.0。
- **reduction** (str) - 缩减输出的方法。默认值:'none'。其他选项:'mean'和'sum'。
返回:
@ -40,5 +40,5 @@ mindspore.ops.smooth_l1_loss
- **TypeError** - `beta` 不是float类型。
- **ValueError** - `reduction` 不是'none''mean'和'sum'中的任一者。
- **TypeError** - `logits``labels` 的数据类型不是float16float32和float64中的任一者。
- **ValueError** - `beta` 小于0。
- **ValueError** - `beta` 小于等于0。
- **ValueError** - `logits``labels` 的shape不同。

View File

@ -2939,18 +2939,18 @@ def smooth_l1_loss(logits, labels, beta=1.0, reduction='none'):
\end{cases}
Here :math:`\text{beta}` controls the point where the loss function changes from quadratic to linear.
Its default value is 1.0. :math:`N` is the batch size.
:math:`\text{beta}>0` , its default value is 1.0. :math:`N` is the batch size.
Args:
logits (Tensor): Tensor of shape :math:`(N, *)` where :math:`*` means, any number of additional dimensions.
labels (Tensor): Ground truth data, tensor of shape :math:`(N, *)`, same shape and dtype as the `logits`.
beta (float): A parameter used to control the point where the function will change from
quadratic to linear. Default: 1.0.
beta (float): A parameter used to control the point where the function will change between
L1 to L2 loss. The value should be greater than zero. Default: 1.0.
reduction (str): Apply specific reduction method to the output: 'none', 'mean' or 'sum'. Default: 'none'.
Returns:
Tensor, if `reduction` is 'none', then output is a tensor with the same shape as `logits`.
Otherwise the shape of output tensor is `(1,)`.
Otherwise, the shape of output tensor is `(1,)`.
Raises:
TypeError: If `beta` is not a float.