Browse Source

modify apiformat

r1.7
xumengjuan1 4 years ago
parent
commit
8ed45d9212
22 changed files with 35 additions and 42 deletions
  1. +0
    -11
      docs/api/api_python/mindspore.ops.rst
  2. +4
    -0
      docs/api/api_python/mindspore.train.rst
  3. +1
    -1
      docs/api/api_python/nn/mindspore.nn.Conv1d.rst
  4. +1
    -1
      docs/api/api_python/nn/mindspore.nn.Perplexity.rst
  5. +1
    -0
      docs/api/api_python/operations.rst
  6. +1
    -1
      docs/api/api_python/ops/mindspore.ops.ArgMaxWithValue.rst
  7. +1
    -1
      docs/api/api_python/ops/mindspore.ops.AvgPool.rst
  8. +1
    -1
      docs/api/api_python/ops/mindspore.ops.BatchNorm.rst
  9. +1
    -1
      docs/api/api_python/ops/mindspore.ops.ComputeAccidentalHits.rst
  10. +3
    -3
      docs/api/api_python/ops/mindspore.ops.Custom.rst
  11. +1
    -1
      docs/api/api_python/ops/mindspore.ops.Dropout2D.rst
  12. +2
    -2
      docs/api/api_python/ops/mindspore.ops.EmbeddingLookup.rst
  13. +2
    -2
      docs/api/api_python/ops/mindspore.ops.Flatten.rst
  14. +1
    -1
      docs/api/api_python/ops/mindspore.ops.ReverseSequence.rst
  15. +1
    -1
      docs/api/api_python/ops/mindspore.ops.ScatterAdd.rst
  16. +1
    -1
      docs/api/api_python/ops/mindspore.ops.ScatterMax.rst
  17. +1
    -2
      docs/api/api_python/ops/mindspore.ops.ScatterMul.rst
  18. +1
    -1
      docs/api/api_python/ops/mindspore.ops.ScatterNd.rst
  19. +1
    -1
      docs/api/api_python/ops/mindspore.ops.Stack.rst
  20. +3
    -3
      docs/api/api_python/ops/mindspore.ops.ms_hybrid.rst
  21. +1
    -1
      docs/api/api_python/ops/mindspore.ops.tensor_dot.rst
  22. +6
    -6
      mindspore/python/mindspore/ops/operations/array_ops.py

+ 0
- 11
docs/api/api_python/mindspore.ops.rst 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

+ 4
- 0
docs/api/api_python/mindspore.train.rst 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:


+ 1
- 1
docs/api/api_python/nn/mindspore.nn.Conv1d.rst View File

@@ -42,7 +42,7 @@ mindspore.nn.Conv1d

**输出:**
Tensor,shape为:math:`(N, C_{out}, L_{out})`。
Tensor,shape为 :math:`(N, C_{out}, L_{out})`

pad_mode为"same"时:



+ 1
- 1
docs/api/api_python/nn/mindspore.nn.Perplexity.rst 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)`
**异常:**


+ 1
- 0
docs/api/api_python/operations.rst View File

@@ -410,6 +410,7 @@ distributed_training_ascend.html#id12>`_ 。
:template: classtemplate.rst

mindspore.ops.Custom
mindspore.ops.ms_hybrid

其他算子
^^^^^^^^^^^^^^^


+ 1
- 1
docs/api/api_python/ops/mindspore.ops.ArgMaxWithValue.rst 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。

**输出:**



+ 1
- 1
docs/api/api_python/ops/mindspore.ops.AvgPool.rst 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]范围内的正整数。

**参数:**


+ 1
- 1
docs/api/api_python/ops/mindspore.ops.BatchNorm.rst 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。


+ 1
- 1
docs/api/api_python/ops/mindspore.ops.ComputeAccidentalHits.rst View File

@@ -14,7 +14,7 @@
**输入:**

- **true_classes** (Tensor) - 目标类。数据类型为int32或int64,shape为 :math:`(batch\_size, num\_true)` 。
- **sampled_candidates** (Tensor) - 指定算子的候选采样结果,代表训练样本的类型。其数据类型为int32或int64,shape为 :math: `(num\_sampled, )` 。
- **sampled_candidates** (Tensor) - 指定算子的候选采样结果,代表训练样本的类型。其数据类型为int32或int64,shape为 :math:`(num\_sampled, )` 。

**输出:**



+ 3
- 3
docs/api/api_python/ops/mindspore.ops.Custom.rst 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** - 算子注册信息不合法,包括支持平台不匹配,算子输入和属性与函数不匹配。

+ 1
- 1
docs/api/api_python/ops/mindspore.ops.Dropout2D.rst 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`,且服从伯努利分布。


+ 2
- 2
docs/api/api_python/ops/mindspore.ops.EmbeddingLookup.rst 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` 。
**输出:**


+ 2
- 2
docs/api/api_python/ops/mindspore.ops.Flatten.rst 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` 是余下维度的乘积。

**异常:**



+ 1
- 1
docs/api/api_python/ops/mindspore.ops.ReverseSequence.rst 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。


+ 1
- 1
docs/api/api_python/ops/mindspore.ops.ScatterAdd.rst 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:]` 。

+ 1
- 1
docs/api/api_python/ops/mindspore.ops.ScatterMax.rst View File

@@ -26,7 +26,7 @@ mindspore.ops.ScatterMax

**输出:**

Tensor,更新后的 `input_x `,shape和类型与 `input_x` 相同。
Tensor,更新后的 `input_x`,shape和类型与 `input_x` 相同。

异常:



+ 1
- 2
docs/api/api_python/ops/mindspore.ops.ScatterMul.rst 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:]` 。

**输出:**



+ 1
- 1
docs/api/api_python/ops/mindspore.ops.ScatterNd.rst View File

@@ -17,7 +17,7 @@ mindspore.ops.ScatterNd

在秩为3的第一个维度中插入两个新值矩阵的计算过程如下图所示:

.. image:: api_img/ScatterNd.png
.. image:: ScatterNd.png

**输入:**



+ 1
- 1
docs/api/api_python/ops/mindspore.ops.Stack.rst 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不相同。

+ 3
- 3
docs/api/api_python/ops/mindspore.ops.ms_hybrid.rst 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` 一个参数。

+ 1
- 1
docs/api/api_python/ops/mindspore.ops.tensor_dot.rst View File

@@ -5,7 +5,7 @@

在任意轴上对Tensor `a` 和 `b` 进行点乘操作。

点乘操作可以在指定轴上计算 `a` 和`b` 元素的乘积和。轴数量必须由x1和x2指定,并且该值必须在 `a` 和 `b` 的维度数量的范围内。
点乘操作可以在指定轴上计算 `a` 和 `b` 元素的乘积和。轴数量必须由x1和x2指定,并且该值必须在 `a` 和 `b` 的维度数量的范围内。

在两个输入中的选定维度且相互匹配。



+ 6
- 6
mindspore/python/mindspore/ops/operations/array_ops.py 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)`.


Loading…
Cancel
Save