fix the documentation of GRU, L2Loss, NLLLoss, etc.

This commit is contained in:
wangshuide2020 2022-03-02 15:40:02 +08:00
parent 6096c06b23
commit d9c3d6e5b7
8 changed files with 11 additions and 7 deletions

View File

@ -17,6 +17,8 @@ mindspore.nn.GRU
其中 :math:`\sigma` 是sigmoid激活函数 :math:`*` 是乘积。 :math:`W,b` 是公式中输出和输入之间的可学习权重。例如, :math:`W_{ir}, b_{ir}` 是用于将输入 :math:`x` 转换为 :math:`r` 的权重和偏置。详见论文 `Learning Phrase Representations using RNN EncoderDecoder for Statistical Machine Translation <https://aclanthology.org/D14-1179.pdf>`_
.. note:: 当GRU运行在Ascend上时hidden size仅支持16的倍数。
**参数:**
- **input_size** (int) - 输入的大小。

View File

@ -20,7 +20,7 @@ mindspore.nn.LSTMCell
其中 :math:`\sigma` 是sigmoid函数 :math:`*` 是乘积。 :math:`W,b` 是公式中输出和输入之间的可学习权重。例如,:math:`W_{ix}, b_{ix}` 是用于从输入 :math:`x` 转换为 :math:`i` 的权重和偏置。详见论文 `LONG SHORT-TERM MEMORY <https://www.bioinf.jku.at/publications/older/2604.pdf>`_`Long Short-Term Memory Recurrent Neural Network Architectures for Large Scale Acoustic Modeling <https://static.googleusercontent.com/media/research.google.com/zh-CN//pubs/archive/43905.pdf>`_
**参数:**
- **input_size** (int) - 输入的大小。
- **hidden_size** (int)- 隐藏状态大小。
- **has_bias** (bool) - cell是否有偏置 `b_ih``b_hh` 。默认值True。

View File

@ -9,7 +9,7 @@
**参数:**
- **num_true** (int)每个训练样本的目标类数。默认值1。
- **num_true** (int) - 每个训练样本的目标类数。默认值1。
**输入:**

View File

@ -13,7 +13,7 @@
**参数:**
- **keep_prob** (float)输入通道保留率数值范围在0到1之间例如 `keep_prob` = 0.8意味着过滤20%的通道。默认值0.5。
- **keep_prob** (float) - 输入通道保留率数值范围在0到1之间例如 `keep_prob` = 0.8意味着过滤20%的通道。默认值0.5。
**输入:**

View File

@ -3,7 +3,7 @@ mindspore.ops.L2Loss
.. py:class:: mindspore.ops.L2Loss()
用于计算L2范数但不对结果进行开方操作。
用于计算L2范数的一半,但不对结果进行开方操作。
把输入设为x输出设为loss。

View File

@ -30,4 +30,4 @@ mindspore.ops.NotEqual
**异常:**
- **TypeError** - `x``y` 不是以下之一Tensor、Number、bool。
- **TypeError** - `x``y` 都不是Tensor。
- **TypeError** - `x``y` 都不是Tensor。

View File

@ -1852,6 +1852,7 @@ class ArgMaxWithValue(PrimitiveWithInfer):
Outputs:
tuple (Tensor), tuple of 2 tensors, containing the corresponding index and the maximum value of the input
tensor.
- index (Tensor) - The index for the maximum value of the input tensor. If `keep_dims` is true, the shape of
output tensors is :math:`(x_1, x_2, ..., x_{axis-1}, 1, x_{axis+1}, ..., x_N)`. Otherwise, the shape is
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
@ -1920,6 +1921,7 @@ class ArgMinWithValue(PrimitiveWithInfer):
Outputs:
tuple (Tensor), tuple of 2 tensors, containing the corresponding index and the minimum value of the input
tensor.
- index (Tensor) - The index for the minimum value of the input tensor. If `keep_dims` is true, the shape of
output tensors is :math:`(x_1, x_2, ..., x_{axis-1}, 1, x_{axis+1}, ..., x_N)`. Otherwise, the shape is
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.

View File

@ -2337,7 +2337,7 @@ class SparseSoftmaxCrossEntropyWithLogits(PrimitiveWithInfer):
.. math::
\begin{array}{ll} \\
p_{ij} = softmax(X_{ij}) = \frac{\exp(x_i)}{\sum_{j = 0}^{N-1}\exp(x_j)} \\
loss_{ij} = \begin{cases} -ln(p_{ij}), &j = y_i \cr -ln(1 - p_{ij}), & j \neq y_i \end{cases} \\
loss_{ij} = \begin{cases} -ln(p_{ij}), &j = y_i \cr 0, & j \neq y_i \end{cases} \\
loss = \sum_{ij} loss_{ij}
\end{array}
@ -2601,7 +2601,7 @@ class SoftMarginLoss(Primitive):
class L2Loss(Primitive):
r"""
Calculates the L2 norm, but do not square the result.
Calculates half of the L2 norm, but do not square the result.
Set input as x and output as loss.