Browse Source

optimizes the documentation of chinese API of ScatterSub,ScatterUpdate,Sqrt,etc.

pull/1/head
zhangfanghe 4 years ago
parent
commit
4534507cbe
16 changed files with 41 additions and 41 deletions
  1. +1
    -1
      docs/api/api_python/ops/mindspore.ops.ScatterSub.rst
  2. +2
    -2
      docs/api/api_python/ops/mindspore.ops.ScatterUpdate.rst
  3. +1
    -1
      docs/api/api_python/ops/mindspore.ops.Sqrt.rst
  4. +3
    -3
      docs/api/api_python/ops/mindspore.ops.Stack.rst
  5. +2
    -2
      docs/api/api_python/ops/mindspore.ops.TensorScatterAdd.rst
  6. +1
    -1
      docs/api/api_python/ops/mindspore.ops.TensorScatterMax.rst
  7. +1
    -1
      docs/api/api_python/ops/mindspore.ops.TensorScatterMin.rst
  8. +2
    -2
      docs/api/api_python/ops/mindspore.ops.TensorScatterSub.rst
  9. +2
    -2
      docs/api/api_python/ops/mindspore.ops.TensorScatterUpdate.rst
  10. +3
    -3
      docs/api/api_python/ops/mindspore.ops.UniformCandidateSampler.rst
  11. +5
    -5
      docs/api/api_python/ops/mindspore.ops.func_clip_by_value.rst
  12. +2
    -2
      docs/api/api_python/ops/mindspore.ops.func_repeat_elements.rst
  13. +2
    -2
      docs/api/api_python/ops/mindspore.ops.func_tensor_dot.rst
  14. +1
    -1
      mindspore/python/mindspore/ops/composite/array_ops.py
  15. +10
    -10
      mindspore/python/mindspore/ops/composite/clip_ops.py
  16. +3
    -3
      mindspore/python/mindspore/ops/operations/array_ops.py

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

@@ -3,7 +3,7 @@

.. py:class:: mindspore.ops.ScatterSub(use_locking=False)

使用给定更新值通过减法操作和输入索引来更新Tensor值。此操作在更新完成后输出 `input_x` ,这有利于更加方便地使用更新后的值。
使用给定更新值通过减法操作和输入索引来更新Tensor值。此操作在更新完成后输出数据 ,这有利于更加方便地使用更新后的值。

对于每个在 `indices.shape` 中的 `i, ..., j` :



+ 2
- 2
docs/api/api_python/ops/mindspore.ops.ScatterUpdate.rst View File

@@ -3,9 +3,9 @@

.. py:class:: mindspore.ops.ScatterUpdate(use_locking=True)

使用给定的更新值和输入索引更新数据的值。
使用给定的更新值和输入索引更新输入Tensor的值。

对于每个在 `indices.shape` 中的 `i, ..., j` :
若 `indices` 的shape为(i, ..., j),则

.. math::
\text{input_x}[\text{indices}[i, ..., j], :]= \text{updates}[i, ..., j, :]


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

@@ -6,7 +6,7 @@
计算输入Tensor的平方根。
.. note::
当输入数据存在一些负数,则返回负数位置上为NaN的Tensor
当输入数据存在一些负数,则负数对应位置上的返回结果为NaN。

.. math::
out_{i} = \sqrt{x_{i}}


+ 3
- 3
docs/api/api_python/ops/mindspore.ops.Stack.rst View File

@@ -3,11 +3,11 @@

.. py:class:: mindspore.ops.Stack(axis=0)

根据指定轴对输入Tensor序列进行堆叠运算
在指定轴上对输入Tensor序列进行堆叠

输入秩为 `R` 的Tensor序列,输出秩为 `(R+1)` 的Tensor。
输入秩为 `R` 的Tensor序列,输出秩为 `(R+1)` 的Tensor。

给定输入Tensor的shape为 :math:`(x_1, x_2, ..., x_R)` 。将输入Tensor的数量设为 `N` 。如果存在 :math:`0 \le axis` ,则输出Tensor的shape为 :math:`(x_1, x_2, ..., x_{axis}, N, x_{axis+1}, ..., x_R)` 。
给定输入Tensor的shape为 :math:`(x_1, x_2, ..., x_R)` 。若输入Tensor的长度为 `N` 。如果存在 :math:`axis \ge 0` ,则输出Tensor的shape为 :math:`(x_1, x_2, ..., x_{axis}, N, x_{axis+1}, ..., x_R)` 。

**参数:**



+ 2
- 2
docs/api/api_python/ops/mindspore.ops.TensorScatterAdd.rst View File

@@ -3,7 +3,7 @@

.. py:class:: mindspore.ops.TensorScatterAdd

根据指定的更新值和输入索引,通过相加运算更新输入Tensor的值。当同一索引有不同值时,更新的结果将是所有值的总和。此操作与ScatterNdAdd类似,只是更新后的结果是通过算子output返回,而不是直接原地更新input。
根据指定的更新值和输入索引,通过相加运算更新输入Tensor的值。当同一索引有不同值时,更新的结果将是所有值的总和。此操作与 :class:`mindspore.ops.ScatterNdAdd` 类似,只是更新后的结果是通过算子output返回,而不是直接原地更新input。

`indices` 的最后一个轴是每个索引向量的深度。对于每个索引向量, `updates` 中必须有相应的值。 `updates` 的shape应该等于 `input_x[indices]` 的shape。有关更多详细信息,请参见使用用例。

@@ -12,7 +12,7 @@

**输入:**

- **input_x** (Tensor) - 输入Tensor。input_x的维度必须不小于indices.shape[-1]。
- **input_x** (Tensor) - 输入Tensor。 `input_x` 的维度必须不小于indices.shape[-1]。
- **indices** (Tensor) - 输入Tensor的索引,数据类型为int32或int64的。其rank必须至少为2。
- **updates** (Tensor) - 指定与 `input_x` 相加操作的Tensor,其数据类型与输入相同。updates.shape应等于indices.shape[:-1] + input_x.shape[indices.shape[-1]:]。



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

@@ -12,7 +12,7 @@

**输入:**

- **input_x** (Tensor) - 输入Tensor。input_x的维度必须不小于indices.shape[-1]。
- **input_x** (Tensor) - 输入Tensor。 `input_x` 的维度必须不小于indices.shape[-1]。
- **indices** (Tensor) - 输入Tensor的索引,数据类型为int32或int64的。其rank必须至少为2。
- **updates** (Tensor) - 指定与 `input_x` 取最大值操作的Tensor,其数据类型与输入相同。updates.shape应等于indices.shape[:-1] + input_x.shape[indices.shape[-1]:]。



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

@@ -13,7 +13,7 @@

**输入:**

- **input_x** (Tensor) - 输入Tensor。input_x的维度必须不小于indices.shape[-1]。
- **input_x** (Tensor) - 输入Tensor。 `input_x` 的维度必须不小于indices.shape[-1]。
- **indices** (Tensor) - 输入Tensor的索引,数据类型为int32或int64。其rank必须至少为2。
- **updates** (Tensor) - 指定与 `input_x` 取最小值操作的Tensor,其数据类型与输入相同。updates.shape应该等于indices.shape[:-1] + input_x.shape[indices.shape[-1]:]。



+ 2
- 2
docs/api/api_python/ops/mindspore.ops.TensorScatterSub.rst View File

@@ -3,7 +3,7 @@

.. py:class:: mindspore.ops.TensorScatterSub

根据指定的更新值和输入索引,通过减法运算更新输入Tensor的值。当同一个索引有多个不同值时,更新的结果将分别减去这些值。此操作几乎等同于使用ScatterNdSub,只是更新后的结果是通过算子output返回,而不是直接原地更新input。
根据指定的更新值和输入索引,通过减法运算更新输入Tensor的值。当同一个索引有多个不同值时,更新的结果将分别减去这些值。此操作几乎等同于使用 :class:`mindspore.ops.ScatterNdSub` ,只是更新后的结果是通过算子output返回,而不是直接原地更新input。

`indices` 的最后一个轴是每个索引向量的深度。对于每个索引向量, `updates` 中必须有相应的值。`updates` 的shape应该等于 `input_x[indices]` 的shape。有关更多详细信息,请参见使用用例。

@@ -12,7 +12,7 @@

**输入:**

- **input_x** (Tensor) - 输入Tensor。input_x的维度必须不小于indices.shape[-1]。
- **input_x** (Tensor) - 输入Tensor。 `input_x` 的维度必须不小于indices.shape[-1]。
- **indices** (Tensor) - 输入Tensor的索引,数据类型为int32或int64的,其rank必须至少为2。
- **updates** (Tensor) - 指定与 `input_x` 相减操作的Tensor,其数据类型与输入相同。updates.shape应等于indices.shape[:-1] + input_x.shape[indices.shape[-1]:]。



+ 2
- 2
docs/api/api_python/ops/mindspore.ops.TensorScatterUpdate.rst View File

@@ -3,7 +3,7 @@

.. py:class:: mindspore.ops.TensorScatterUpdate

根据指定的更新值和输入索引,通过更新操作更新输入Tensor的值。此操作几乎等同于使用ScatterNd,只是更新操作应用到 `input_x` Tensor而不是0。
根据指定的更新值和输入索引,通过更新操作更新输入Tensor的值。此操作几乎等同于使用 :class:`mindspore.ops.ScatterNd` ,只是更新操作应用到 `input_x` Tensor而不是0。

`indices` 的rank至少要为2,最后一个轴表示每个索引向量的深度。对于每个索引向量, `update` 中必须有相应的值。如果每个索引Tensor的深度与 `input_x` 的rank匹配,则每个索引向量对应于 `input_x` 中的Scalar,并且每次更新都会更新一个Scalar。如果每个索引Tensor的深度小于 `input_x` 的rank,则每个索引向量对应于 `input_x` 中的切片,并且每次更新都会更新一个切片。

@@ -11,7 +11,7 @@

**输入:**

- **input_x** (Tensor) - TensorScatterUpdate的输入,任意维度的Tensor。其数据类型为Number。input_x的维度必须不小于indices.shape[-1]。
- **input_x** (Tensor) - TensorScatterUpdate的输入,任意维度的Tensor。其数据类型为数值型。 `input_x` 的维度必须不小于indices.shape[-1]。
- **indices** (Tensor) - 输入Tensor的索引,数据类型为int32或int64。其rank必须至少为2。
- **update** (Tensor) - 指定与 `input_x` 做更新操作的Tensor,其数据类型与输入相同。update.shape应等于indices.shape[:-1] + input_x.shape[indices.shape[-1]:]。



+ 3
- 3
docs/api/api_python/ops/mindspore.ops.UniformCandidateSampler.rst View File

@@ -3,14 +3,14 @@

.. py:class:: mindspore.ops.UniformCandidateSampler(num_true, num_sampled, unique, range_max, seed=0, remove_accidental_hits=False)

使用均匀分布对一组类进行采样。
使用均匀分布对一组类进行采样。
此函数在均匀分布的基础上从[0, range_max-1]中采样一组类(sampled_candidates)。如果unique=True,则候选采样没有重复;如果unique=False,则有重复。
此函数使用均匀分布从[0, range_max-1]中采样一组类(sampled_candidates)。如果 `unique` 为True,则候选采样没有重复;如果 `unique` 为False,则有重复。

**参数:**

- **num_true** (int) - 每个训练样本的目标类数。
- **num_sampled** (int) - 随机采样的类数。sampled_candidates的shape将为num_sampled。如果unique=True,则num_sampled必须小于或等于range_max
- **num_sampled** (int) - 随机采样的类数。sampled_candidates的shape将为 `num_sampled` 。如果`unique` 为True,则 `num_sampled` 必须小于或等于 `range_max`
- **unique** (bool) - 表示一个batch中的所有采样类是否唯一。
- **range_max** (int) - 可能的类数,该值必须是非负的。
- **seed** (int) - 随机种子,该值必须是非负的。如果seed的值为0,则seed的值将被随机生成的值替换。默认值:0。


+ 5
- 5
docs/api/api_python/ops/mindspore.ops.func_clip_by_value.rst View File

@@ -5,18 +5,18 @@

将输入Tensor值裁剪到指定的最小值和最大值之间。

限制 :math:`x` 的范围,其 :math:`x` 的最小值为'clip_value_min',最大值为'clip_value_max'
限制 :math:`x` 的范围,其 :math:`x` 的最小值为 `clip_value_min` ,最大值为 `clip_value_max`

.. math::
out_i= \left\{
\begin{array}{align}
clip\_value_{max} & \text{ if } x_i\ge clip\_value_{max} \\
x_i & \text{ if } clip\_value_{min} \lt x_i \lt clip\_value_{max} \\
clip\_value_{min} & \text{ if } x_i \le clip\_value_{min} \\
clip\_value\_max & \text{ if } x_i\ge clip\_value\_max \\
x_i & \text{ if } clip\_value\_min \lt x_i \lt clip\_value\_max \\
clip\_value\_min & \text{ if } x_i \le clip\_value\_min \\
\end{array}\right.

.. note::
'clip_value_min'必须小于或等于'clip_value_max'
`clip_value_min` 必须小于或等于 `clip_value_max`

**参数:**



+ 2
- 2
docs/api/api_python/ops/mindspore.ops.func_repeat_elements.rst View File

@@ -3,13 +3,13 @@ mindspore.ops.repeat_elements

.. py:function:: mindspore.ops.repeat_elements(x, rep, axis=0)

根据指定轴复制输入Tensor的元素,类似np.repeat的功能。
在指定轴上复制输入Tensor的元素,类似 `np.repeat` 的功能。

**参数:**

- **x** (Tensor) - 输入Tensor。类型为float16、float32、int8、uint8、int16、int32或int64。
- **rep** (int) - 指定复制次数,为正数。
- **axis** (int) - 指定复制轴,默认0。
- **axis** (int) - 指定复制轴,默认值:0。

**输出:**


+ 2
- 2
docs/api/api_python/ops/mindspore.ops.func_tensor_dot.rst View File

@@ -3,11 +3,11 @@

.. py:function:: mindspore.ops.tensor_dot(x1, x2, axes)

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

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

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

axes = 0为外积。axes = 1为普通矩阵乘法(输入是2维的)。axes = 1与axes = ((1,),(0,)相同,其中 `a` 和 `b` 都是2维的。axes = 2与axes = ((1,2),(0,1))相同,其中 `a` 和 `b` 都是3维的。



+ 1
- 1
mindspore/python/mindspore/ops/composite/array_ops.py View File

@@ -57,7 +57,7 @@ def _cal_reshape(x_shape, rep, axis):

def repeat_elements(x, rep, axis=0):
"""
Repeat elements of a tensor along an axis, like np.repeat.
Repeat elements of a tensor along an axis, like `np.repeat` .

Args:
x (Tensor): The tensor to repeat values for. Must be of type: float16,


+ 10
- 10
mindspore/python/mindspore/ops/composite/clip_ops.py View File

@@ -72,32 +72,32 @@ def clip_by_value(x, clip_value_min=None, clip_value_max=None):
r"""
Clips tensor values to a specified min and max.

Limits the value of :math:`x` to a range, whose lower limit is 'clip_value_min'
and upper limit is 'clip_value_max'.
Limits the value of :math:`x` to a range, whose lower limit is `clip_value_min`
and upper limit is `clip_value_max` .

.. math::

out_i= \left\{
\begin{array}{align}
clip\_value_{max} & \text{ if } x_i\ge clip\_value_{max} \\
x_i & \text{ if } clip\_value_{min} \lt x_i \lt clip\_value_{max} \\
clip\_value_{min} & \text{ if } x_i \le clip\_value_{min} \\
clip\_value\_max & \text{ if } x_i\ge clip\_value\_max \\
x_i & \text{ if } clip\_value\_min \lt x_i \lt clip\_value\_max \\
clip\_value\_min & \text{ if } x_i \le clip\_value\_min \\
\end{array}\right.

Note:
'clip_value_min' needs to be less than or equal to 'clip_value_max'. The data type of x, clip_value_min and
clip_value_max should support implicit type conversion and cannot all be bool type.
`clip_value_min` needs to be less than or equal to `clip_value_max` . The data type of x, `clip_value_min` and
`clip_value_max` should support implicit type conversion and cannot all be bool type.

Args:
x (Tensor): Input data. The shape is :math:`(N,*)` where :math:`*` means, any number of additional dimensions.
clip_value_min (Tensor): The minimum value. clip_value_min and clip_value_max cannot be all None.
clip_value_min (Tensor): The minimum value. `clip_value_min` and `clip_value_max` cannot be all None.
Default: None.
clip_value_max (Tensor): The maximum value. clip_value_min and clip_value_max cannot be all None.
clip_value_max (Tensor): The maximum value. `clip_value_min` and `clip_value_max` cannot be all None.
Default: None.

Returns:
Tensor, a clipped Tensor. The data type is the one with higher precision or higher digits among
the x, clip_value_min and clip_value_max.
the x, `clip_value_min` and `clip_value_max` .

Supported Platforms:
``Ascend`` ``GPU`` ``CPU``


+ 3
- 3
mindspore/python/mindspore/ops/operations/array_ops.py View File

@@ -4163,7 +4163,7 @@ class TensorScatterUpdate(PrimitiveWithInfer):
"""
Creates a new tensor by updating the positions in `input_x` indicated by
`indices`, with values from `update`. This operation is almost equivalent to using
ScatterNd, except that the updates are applied on `input_x` instead of a zero tensor.
:class:`mindspore.ops.ScatterNd` , except that the updates are applied on `input_x` instead of a zero tensor.

`indices` must have rank at least 2, the last axis is the depth of each index
vectors. For each index vector, there must be a corresponding value in `update`. If
@@ -4265,7 +4265,7 @@ class TensorScatterAdd(PrimitiveWithInfer):
Creates a new tensor by adding the values from the positions in `input_x` indicated by
`indices`, with values from `updates`. When multiple values are given for the same
index, the updated result will be the sum of all values. This operation is almost
equivalent to using ScatterNdAdd, except that the updates are applied on output `Tensor`
equivalent to using :class:`mindspore.ops.ScatterNdAdd` , except that the updates are applied on output `Tensor`
instead of input `Parameter`.

The last axis of `indices` is the depth of each index vectors. For each index vector,
@@ -6755,7 +6755,7 @@ class TensorScatterSub(PrimitiveWithInfer):
Creates a new tensor by subtracting the values from the positions in `input_x` indicated by
`indices`, with values from `updates`. When multiple values are provided for the same
index, the result of the update will be to subtract these values respectively. This operation is almost
equivalent to using ScatterNdSub, except that the updates are applied on output `Tensor`
equivalent to using :class:`mindspore.ops.ScatterNdSub` , except that the updates are applied on output `Tensor`
instead of input `Parameter`.

The last axis of `indices` is the depth of each index vectors. For each index vector,


Loading…
Cancel
Save