!32187 optimizes the documentation of chinese API of Broadcast,CumSum,Dropout3D,etc

Merge pull request !32187 from zhangfanghe/code_docs_zfh_329
This commit is contained in:
i-robot 2022-03-30 04:24:35 +00:00 committed by Gitee
commit a2854fe963
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
16 changed files with 37 additions and 39 deletions

View File

@ -23,4 +23,4 @@
**异常:**
- **TypeError** - root_rank不是整数或group不是字符串
- **TypeError** - root_rank不是int或group不是str

View File

@ -3,8 +3,6 @@
.. py:class:: mindspore.ops.BroadcastTo(shape)
对输入Tensor广播到指定shape。
将输入shape广播到目标shape。如果目标shape中有-1的维度它将被该维度中的输入shape的值替换。
当输入shape广播到目标shape时它从最后一个维度开始。如果目标shape中有-1的维度则-1维度不能位于一个不存在的维度中。

View File

@ -3,7 +3,7 @@
.. py:class:: mindspore.ops.Cast
返回指定新数据类型后的Tensor
转换输入Tensor的数据类型。
**输入:**

View File

@ -3,9 +3,9 @@
.. py:class:: mindspore.ops.ComputeAccidentalHits(num_true=1)
计算与候选抽样目标类匹配的位置id。
计算与目标类完全匹配的抽样样本的位置id。
当目标类与样类匹配时,我们称之为"accidental hit"。accidental hit的计算结果包含三部分(index、id、weight)其中index代表目标类中的行号id代表候选抽样中的位置weight为FLOAT_MAX。FLOAT_MAX表示Float类型中的最大值。
当目标类与样类匹配时,我们称之为"accidental hit"。accidental hit的计算结果包含三部分(indices、ids、weights)其中index代表目标类中的行号id代表候选抽样中的位置weight为float类型中的最大值。
**参数:**
@ -14,7 +14,7 @@
**输入:**
- **true_classes** (Tensor) - 目标类。数据类型为int32或int64shape为 :math:`(batch\_size, num\_true)`
- **sampled_candidates** (Tensor) - 指定算子的候选采样结果,代表训练样本的类。其数据类型为int32或int64shape为 :math:`(num\_sampled, )`
- **sampled_candidates** (Tensor) - 算子的候选采样结果,代表训练样本的类。其数据类型为int32或int64shape为 :math:`(num\_sampled, )`
**输出:**

View File

@ -5,7 +5,7 @@
在指定轴上拼接输入Tensor。
输入的是一个tuple。其元素秩相同`R` 。将给定的轴设为 `m` ,并且 :math:`0 \le m < R` 。数量设为 `N` 。对于第 :math:`i` 个数据, :math:`t_i` 的shape为 `(x_1, x_2, ..., x_{mi}, ..., x_R)`:math:`x_{mi}` 是第 :math:`i` 个元素的第 :math:`m` 个维度。然后输出tensor的shape为
输入的是一个tuple。其元素秩相同`R` 。将给定的轴设为 `m` ,并且 :math:`0 \le m < R`输入元素的数量设为 `N` 。对于第 :math:`i` 个数据, :math:`t_i` 的shape为 `(x_1, x_2, ..., x_{mi}, ..., x_R)`:math:`x_{mi}` 是第 :math:`i` 个元素的第 :math:`m` 个维度。输出tensor的shape为
.. math::
(x_1, x_2, ..., \sum_{i=1}^Nx_{mi}, ..., x_R)
@ -19,7 +19,7 @@
**输入:**
- **input_x** (tuple, list) - 输入为Tensor tuple或Tensor list。假设在这个tuple或list中有两个Tensor即x1和x2。要在0轴方向上执行 `Concat` 除0轴外所有其他轴都应相等,即 :math:`x1.shape[1] == x2.shape[1]x1.shape[2] == x2.shape[2]...x1.shape[R] == x2.shape[R]` ,其中 :math:`R` 表示最后一个轴。
- **input_x** (tuple, list) - 输入为Tensor组成的tuple或list。假设在这个tuple或list中有两个Tensor即x1和x2。要在0轴方向上执行 `Concat` 除0轴外其他轴的shape都应相等,即 :math:`x1.shape[1] == x2.shape[1]x1.shape[2] == x2.shape[2]...x1.shape[R] == x2.shape[R]` ,其中 :math:`R` 表示最后一个轴。
**输出:**

View File

@ -3,7 +3,7 @@
.. py:class:: mindspore.ops.CumSum(exclusive=False, reverse=False)
在指定轴上计算输入Tensor的累加和。
计算输入Tensor在指定轴上的累加和。
.. math::
y_i = x_1 + x_2 + x_3 + ...+ x_i

View File

@ -3,11 +3,11 @@
.. py:class:: mindspore.ops.Dropout(keep_prob=0.5, Seed0=0, Seed1=0)
Dropout是一种正则化手段该算子根据丢弃概率 :math:`1 - keep\_prob` 在训练过程中随机将一些神经元输出设置为0通过阻止神经元节点间的相关性来减少过拟合。
Dropout是一种正则化手段通过在训练中以 :math:`1 - keep\_prob` 的概率随机将神经元输出设置为0起到减少神经元相关性的作用避免过拟合。
**参数:**
- **keep_prob** (float) - 输入神经元保留数值范围在0到1之间。例如rate=0.9删除10%的输入单位。默认值0.5。
- **keep_prob** (float) - 输入神经元保留概率数值范围在0到1之间。例如keep_prob=0.9删除10%的神经元。默认值0.5。
- **Seed0** (int) - 算子层的随机种子用于生成随机数。默认值0。
- **Seed1** (int) - 全局的随机种子和算子层的随机种子共同决定最终生成的随机数。默认值0。

View File

@ -5,11 +5,11 @@
随机丢弃层。
Dropout是一种正则化手段该算子根据丢弃概率 :math:`1 - keep\_prob` 在训练过程中随机将一些神经元输出设置为0通过阻止神经元节点间的相关性来减少过拟合在推理过程中,此层返回与 `x` 相同的Tensor。对于shape为NCDHW的五维Tensor通道特征图指的是shape为DHW的三维特征图。
Dropout是一种正则化手段通过在训练中以 :math:`1 - keep\_prob` 的概率随机将神经元输出设置为0起到减少神经元相关性的作用避免过拟合。在推理过程中,此层返回与 `x` 相同的Tensor。对于shape为NCDHW的五维Tensor通道特征图指的是shape为DHW的三维特征图。
例如,输入的批数据中第 :math:`i_th` 个样本的第 :math:`j_th` 个通道则可三维Tensor input[i,j,k]。
Dropout3D可以提高feature map之间的独立性。
Dropout3D可以提高feature map之间的独立性。
**参数:**

View File

@ -5,13 +5,13 @@ mindspore.ops.EmbeddingLookup
根据指定的索引返回输入Tensor的切片。
此算子在 `axis = 0` 上的运行与GatherV2的功能相似只是多一个输入: `offset` 参数
此算子在 `axis = 0` 上的运行与GatherV2的功能相似只是多一个 `offset` 输入
**输入:**
- **input_params** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)` 的Tensor。是一个Tensor切片。当前只支持二维。
- **input_indices** (Tensor) - shape为 :math:`(y_1, y_2, ..., y_S)` 的Tensor。指定输入Tensor元素的索引。当取值超出 `input_params` 的范围时超出部分在输出时填充为0。不支持负值如果为负值则结果未定义。其数据类型为int32或int64。
- **offset** (int) - 指定 `input_params` 切片的偏移值。因此,实际索引等于 `input_indices` 减去 `offset`
- **input_indices** (Tensor) - shape为 :math:`(y_1, y_2, ..., y_S)` 的Tensor。指定输入Tensor元素的索引。当取值超出 `input_params` 在该维度的最大长度时超出部分将返回0值。不支持负值否则结果将未定义。其数据类型为int32或int64。
- **offset** (int) - 指定 `input_params` 切片的偏移值。实际索引等于 `input_indices` 减去 `offset`
**输出:**

View File

@ -5,6 +5,12 @@ mindspore.ops.Equal
逐元素比较两个输入Tensor是否相等。
.. math::
out_{i} =\begin{cases}
& \text{True, if } x_{i} = y_{i} \\
& \text{False, if } x_{i} \ne y_{i}
\end{cases}
.. note::
- 输入 `x``y` 遵循隐式类型转换规则,使数据类型保持一致。
- 输入必须是两个Tensor或一个Tensor和一个Scalar。
@ -12,16 +18,10 @@ mindspore.ops.Equal
- 当输入是一个Tensor和一个Scalar时Scalar只能是一个常数。
- 支持广播。
.. math::
out_{i} =\begin{cases}
& \text{True, if } x_{i} = y_{i} \\
& \text{False, if } x_{i} \ne y_{i}
\end{cases}
**输入:**
- **x** (Union[Tensor, Number]) - 第一个输入可以是Number也可以是数据类型为Number的Tensor。
- **y** (Union[Tensor, Number]) - 当第一个输入是Tensor时第二个输入是Number或数据类型为Number的Tensor。数据类型与第一个输入相同。
- **x** (Union[Tensor, Number]) - 第一个输入可以是数值型也可以是数据类型为数值型的Tensor。
- **y** (Union[Tensor, Number]) - 当第一个输入是Tensor时第二个输入是数值型或数据类型为数值型的Tensor。数据类型与第一个输入相同。
**输出:**

View File

@ -3,7 +3,7 @@ mindspore.ops.Flatten
.. py:class:: mindspore.ops.Flatten
扁平化Flatten输入Tensor改0轴batch size。
扁平化Flatten输入Tensor不改0轴的size。
**输入:**

View File

@ -3,7 +3,7 @@ mindspore.ops.GatherD
.. py:class:: mindspore.ops.GatherD
沿指定轴收集元素。
获取指定轴的元素。
对于三维Tensor输出为
@ -15,13 +15,13 @@ mindspore.ops.GatherD
output[i][j][k] = x[i][j][index[i][j][k]] # if dim == 2
如果 `x` 是shape为 :math:`(z_0, z_1, ..., z_i, ..., z_{n-1})` ,维度`dim` = i的n维Tensor`index` 必须是shape为 :math:`(z_0, z_1, ..., y, ..., z_{n-1})` 的n维Tensor其中 `y` 大于等于1输出的shape与 `index` 相同。
如果 `x` 是shape为 :math:`(z_0, z_1, ..., z_i, ..., z_{n-1})` ,维度 `dim`i的n维Tensor`index` 必须是shape为 :math:`(z_0, z_1, ..., y, ..., z_{n-1})` 的n维Tensor其中 `y` 大于等于1输出的shape与 `index` 相同。
**输入:**
- **x** (Tensor) - GatherD的输入任意维度的Tensor。
- **dim** (int) - 指定索引的轴。数据类型为int32或int64。只能是常量值。
- **index** (Tensor) - 指定收集元素的索引。支持的数据类型包括int32int64。每个索引元素的取值范围为[-x_rank[dim], x_rank[dim])。
- **dim** (int) - 获取元素的轴。数据类型为int32或int64。只能是常量值。
- **index** (Tensor) - 获取收集元素的索引。支持的数据类型包括int32int64。每个索引元素的取值范围为[-x_rank[dim], x_rank[dim])。
**输出:**

View File

@ -3,14 +3,14 @@ mindspore.ops.GatherNd
.. py:class:: mindspore.ops.GatherNd
根据索引获取输入数据指定位置上的元素。
根据索引获取输入Tensor指定位置上的元素。
`indices` 是K维整型Tensor。可以看作是从 `input_x` 中取K-1维Tensor每个元素都是一个切片
`indices` 是K维整型Tensor则可看作是从 `input_x` 中取K-1维Tensor每个元素都是一个切片
.. math::
output[(i_0, ..., i_{K-2})] = input\_x[indices[(i_0, ..., i_{K-2})]]
`indices` 的最后一维度不能超过 `input_x` 的秩: :math:`indices.shape[-1] <= input\_x.rank`
`indices` 的最后一维的长度不能超过 `input_x` 的秩: :math:`indices.shape[-1] <= input\_x.rank`
**输入:**
@ -19,9 +19,9 @@ mindspore.ops.GatherNd
**输出:**
Tensor数据类型与 `input_x` 相同shape为indices_shape[:-1] + x_shape[indices_shape[-1]:]。
Tensor数据类型与 `input_x` 相同shape为 `indices_shape[:-1] + x_shape[indices_shape[-1]:]`
**异常:**
- **ValueError** - `input_x` 的shape长度小于 `indices` 的最后一维度。
- **ValueError** - `input_x` 的shape长度小于 `indices` 的最后一维的长度。

View File

@ -6,12 +6,12 @@ mindspore.ops.GetNext
返回数据集队列中的下一个元素。
.. note::
GetNext操作需要联网且依赖init_dataset接口不能单独操作。详见 `connect_network_with_dataset` 的源码。
GetNext操作需要联网且依赖init_dataset接口不能单独操作。详见 :class:`mindspore.connect_network_with_dataset` 的源码。
**参数:**
- **types** (list[:class:`mindspore.dtype`]) - 输出的数据类型。
- **shapes** (list[tuple[int]]) - 输出数据大小。
- **shapes** (list[tuple[int]]) - 输出数据的shape大小。
- **output_num** (int) - 输出编号、 `types``shapes` 的长度。
- **shared_name** (str) - `init_dataset` 接口名称。

View File

@ -3,7 +3,7 @@ mindspore.ops.Identity
.. py:class:: mindspore.ops.Identity
返回与输入具有相同shape和值Tensor。
返回与输入具有相同shape和值Tensor。
**输入:**

View File

@ -3,7 +3,7 @@ mindspore.ops.IsNan
.. py:class:: mindspore.ops.IsNan
判断输入数据每个位置上的值是否是NaN
判断输入数据每个位置上的值是否是Nan
.. math::