modify apiformat

This commit is contained in:
xumengjuan1 2022-03-10 11:26:08 +08:00
parent 98888f6cd8
commit 8ed45d9212
22 changed files with 35 additions and 42 deletions

View File

@ -399,14 +399,3 @@ functional算子是经过初始化后的Primitive可以直接作为函数使
mindspore.ops.DataType
mindspore.ops.op_info_register
mindspore.ops.TBERegOp
自定义算子
----------------
.. mscnautosummary::
:toctree: ops
:nosignatures:
:template: classtemplate.rst
mindspore.ops.Custom
mindspore.ops.ms_hybrid

View File

@ -29,6 +29,10 @@ mindspore.train.callback
.. include:: train/mindspore.train.callback.SummaryLandscape.rst
.. include:: train/mindspore.train.callback.History.rst
.. include:: train/mindspore.train.callback.LambdaCallback.rst
.. automodule:: mindspore.train.callback
:exclude-members: FederatedLearningManager
:members:

View File

@ -42,7 +42,7 @@ mindspore.nn.Conv1d
**输出:**
Tensorshape为:math:`(N, C_{out}, L_{out})`
Tensorshape为 :math:`(N, C_{out}, L_{out})`
pad_mode为"same"时:

View File

@ -35,7 +35,7 @@ mindspore.nn.Perplexity
**参数:**
- **inputs** - 输入 `preds``labels``preds``labels` 是Tensor、list或numpy.ndarray。 `preds` 是预测值, `labels` 是数据的标签。 `preds``labels` 的shape都是:math:`(N, C)`
- **inputs** - 输入 `preds``labels``preds``labels` 是Tensor、list或numpy.ndarray。 `preds` 是预测值, `labels` 是数据的标签。 `preds``labels` 的shape都是 :math:`(N, C)`
**异常:**

View File

@ -410,6 +410,7 @@ distributed_training_ascend.html#id12>`_ 。
:template: classtemplate.rst
mindspore.ops.Custom
mindspore.ops.ms_hybrid
其他算子
^^^^^^^^^^^^^^^

View File

@ -21,7 +21,7 @@
**输入:**
- **input_x** (Tensor) - 输入任意维度的Tensor。将输入Tensor的shape设为 :math: `(x_1, x_2, ..., x_N)` 。数据类型为mindspore.float16或float32。
- **input_x** (Tensor) - 输入任意维度的Tensor。将输入Tensor的shape设为 :math:`(x_1, x_2, ..., x_N)` 。数据类型为mindspore.float16或float32。
**输出:**

View File

@ -13,7 +13,7 @@ mindspore.ops.AvgPool
.. warning::
- 支持全局池化。
- 在Ascend上"kernel_size"的高度和权重取值为[1, 255]范围内的正整数。 :math: ksize_H * ksize_W < 256
- 在Ascend上"kernel_size"的高度和权重取值为[1, 255]范围内的正整数。 :math:`ksize_H * ksize_W < 256`
- 由于指令限制,"strides_h"和"strides_w"的取值为[1, 63]范围内的正整数。
**参数:**

View File

@ -50,7 +50,7 @@ mindspore.ops.BatchNorm
- **batch_variance** (Tensor) - 输入的方差shape为 :math:`(C,)` 的一维Tensor。
- **reserve_space_1** (Tensor) - 需要计算梯度时被重新使用的均值shape为 :math:`(C,)` 的一维Tensor。
- **reserve_space_2** (Tensor) - 需要计算梯度时被重新使用的方差shape为 :math:`(C,)` 的一维Tensor。
**异常:**
- **TypeError** `is_training` 不是bool。

View File

@ -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

@ -3,7 +3,7 @@ mindspore.ops.Custom
.. py:class:: mindspore.ops.Custom(exclusive=False, reverse=False)
`Custom`算子是MindSpore自定义算子的统一接口。用户可以利用该接口自行定义MindSpore内置算子库尚未包含的算子。
`Custom` 算子是MindSpore自定义算子的统一接口。用户可以利用该接口自行定义MindSpore内置算子库尚未包含的算子。
根据输入函数的不用,你可以创建多个自定义算子,并且把它们用在神经网络中。
关于自定义算子的详细说明和介绍,包括参数的正确书写,见编程指南 https://www.mindspore.cn/docs/programming_guide/zh-CN/master/custom_operator_custom.html 。
@ -28,6 +28,6 @@ mindspore.ops.Custom
**异常:**
- **TypeError** - 如果输入`func`不合法,或者`func`对应的注册信息类型不对。
- **ValueError** - `func_type`的值不在列表内。
- **TypeError** - 如果输入 `func` 不合法,或者 `func` 对应的注册信息类型不对。
- **ValueError** - `func_type` 的值不在列表内。
- **ValueError** - 算子注册信息不合法,包括支持平台不匹配,算子输入和属性与函数不匹配。

View File

@ -3,7 +3,7 @@ mindspore.ops.Dropout2D
.. py:class:: mindspore.ops.Dropout2D(keep_prob=0.5)
在训练期间,根据概率 :math:`1 - keep\_prob` 随机的将一些通道设置为0且服从伯努利分布。对于shape为 :math:`(N, C, H, W)` 的四维Tensor通道特征图指的是shape为 :math:`(H, W)`的二维特征图。)
在训练期间,根据概率 :math:`1 - keep\_prob` 随机的将一些通道设置为0且服从伯努利分布。对于shape为 :math:`(N, C, H, W)` 的四维Tensor通道特征图指的是shape为 :math:`(H, W)` 的二维特征图。)
例如,对于批量输入的第 :math:`i_th` 样本的第:math:`j_th` 通道为二维Tensor即input[i,j]。在前向传播过程中输入样本的每个通道都有可能被置为0置为0的概率为 :math:`1 - keep\_prob`,且服从伯努利分布。

View File

@ -9,8 +9,8 @@ mindspore.ops.EmbeddingLookup
**输入:**
- **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。
- **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`
**输出:**

View File

@ -7,11 +7,11 @@ mindspore.ops.Flatten
**输入:**
- **input_x** (Tensor) - 待扁平化的Tensor其shape为 :math:`(N, \ldots)` :math: `N` 表示batch size。
- **input_x** (Tensor) - 待扁平化的Tensor其shape为 :math:`(N, \ldots)` :math:`N` 表示batch size。
**输出:**
Tensor输出shape为 :math:`(N,X)` 的Tensor其中 :math:`X` 是余下维度的乘积。
Tensor输出shape为 :math:`(N, X)` 的Tensor其中 :math:`X` 是余下维度的乘积。
**异常:**

View File

@ -10,7 +10,7 @@ mindspore.ops.ReverseSequence
- **seq_dim** (int) - 指定反转的维度,此值为必填参数。
- **batch_dim** (int) - 指定切片维度。默认值0。
** 输入:**
**输入:**
- **x** (Tensor) - 输入需反转的数据其数据类型支持包括bool在内的所有Number类型。
- **seq_lengths** (Tensor) - 指定反转长度为一维向量其数据类型为int32或int64。

View File

@ -33,4 +33,4 @@ mindspore.ops.ScatterAdd
- **TypeError** - `use_locking` 不是bool。
- **TypeError** - `indices` 不是int32。
- **ValueError ** - `updates` 的shape不等于 `indices_shape + x_shape[1:]`
- **ValueError** - `updates` 的shape不等于 `indices_shape + x_shape[1:]`

View File

@ -26,7 +26,7 @@ mindspore.ops.ScatterMax
**输出:**
Tensor更新后的 `input_x `shape和类型与 `input_x` 相同。
Tensor更新后的 `input_x`shape和类型与 `input_x` 相同。
异常:

View File

@ -1,5 +1,5 @@
mindspore.ops.ScatterMul
=========================
.. py:class:: mindspore.ops.ScatterMul(use_locking=False)
@ -21,7 +21,6 @@ mindspore.ops.ScatterMul
- **input_x** (Parameter) - ScatterMul的输入任意维度的Parameter。
- **indices** (Tensor) - 指定相乘操作的索引数据类型必须为mindspore.int32。
- **updates** (Tensor) - 指定与 `input_x` 相乘的Tensor数据类型与 `input_x` 相同shape为 `indices_shape + x_shape[1:]`
**输出:**

View File

@ -17,7 +17,7 @@ mindspore.ops.ScatterNd
在秩为3的第一个维度中插入两个新值矩阵的计算过程如下图所示
.. image:: api_img/ScatterNd.png
.. image:: ScatterNd.png
**输入:**

View File

@ -24,4 +24,4 @@
**异常:**
- **TypeError** - `input_x` 中元素的数据类型不相同。
- **ValueError** - `input_x` 的长度不大于1或axis不在[-(R+1),R+1)范围中,或 input_x` 中元素的shape不相同。
- **ValueError** - `input_x` 的长度不大于1或axis不在[-(R+1),R+1)范围中,或 `input_x` 中元素的shape不相同。

View File

@ -5,8 +5,8 @@ mindspore.ops.ms_hybrid
用于MindSpore Hybrid DSL函数书写的装饰器。
给用MindSpore Hybrid DSL书写的函数加上此装饰器后它可以用作一个普通的Python函数。
与此同时,他可以用于自定义算子:class:`mindspore.ops.Custom`的输入,其对应的`func_type`可以设置为`hybrid`或者`pyfunc`
使用`hybrid`类型的:class:`mindspore.ops.Custom`自定义算子可以自动推导数据类型和形状。
与此同时,他可以用于自定义算子 :class:`mindspore.ops.Custom` 的输入,其对应的 `func_type` 可以设置为 `hybrid` 或者 `pyfunc`
使用 `hybrid` 类型的 :class:`mindspore.ops.Custom` 自定义算子可以自动推导数据类型和形状。
**参数:**
@ -16,4 +16,4 @@ mindspore.ops.ms_hybrid
**输出:**
Function如果`fn`不是None那么返回一个用Hybrid DSL写的可执行函数如果`fn`是None则返回一个装饰器该装饰器只有`fn`一个参数。
Function如果 `fn` 不是None那么返回一个用Hybrid DSL写的可执行函数如果 `fn` 是None则返回一个装饰器该装饰器只有 `fn` 一个参数。

View File

@ -5,7 +5,7 @@
在任意轴上对Tensor `a``b` 进行点乘操作。
点乘操作可以在指定轴上计算 `a``b` 元素的乘积和。轴数量必须由x1和x2指定并且该值必须在 `a``b` 的维度数量的范围内。
点乘操作可以在指定轴上计算 `a` `b` 元素的乘积和。轴数量必须由x1和x2指定并且该值必须在 `a``b` 的维度数量的范围内。
在两个输入中的选定维度且相互匹配。

View File

@ -1854,8 +1854,8 @@ class ArgMaxWithValue(PrimitiveWithInfer):
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)`.
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)` .
- output_x (Tensor) - The maximum value of input tensor, with the same shape as index.
Raises:
@ -1916,15 +1916,15 @@ class ArgMinWithValue(PrimitiveWithInfer):
Inputs:
- **input_x** (Tensor) - The input tensor, can be any dimension. Set the shape of input tensor as
:math:`(x_1, x_2, ..., x_N)`.
:math:`(x_1, x_2, ..., x_N)` .
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)`.
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)` .
- output_x (Tensor) - The minimum value of input tensor, with the same shape as index.
Raises:
@ -1977,7 +1977,7 @@ class Tile(PrimitiveWithInfer):
Inputs:
- **input_x** (Tensor) - 1-D or higher dimensional Tensor. Set the shape of input tensor as
:math:`(x_1, x_2, ..., x_S)`.
:math:`(x_1, x_2, ..., x_S)` .
- **multiples** (tuple[int]) - The parameter that specifies the number of replications,
the parameter type is tuple, and the data type is int, i.e., :math:`(y_1, y_2, ..., y_S)`.