!38642 Add functional doc

Merge pull request !38642 from ZPaC/add-argmin-func-doc
This commit is contained in:
i-robot 2022-07-24 14:10:47 +00:00 committed by Gitee
commit 4e87c22f88
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 39 additions and 2 deletions

View File

@ -233,6 +233,7 @@ Reduction函数
mindspore.ops.logsumexp
mindspore.ops.max
mindspore.ops.norm
mindspore.ops.min
.. list-table::
:widths: 50 50

View File

@ -0,0 +1,34 @@
mindspore.ops.min
==============================
.. py:function:: mindspore.ops.min(x, axis=0, keep_dims=False)
根据指定的索引计算最小值,并返回索引和值。
在给定轴上计算输入Tensor的最小值并且返回最小值和索引。
.. note::
在auto_parallel和semi_auto_parallel模式下不能使用第一个输出索引。
.. warning::
- 如果有多个最小值,则取第一个最小值的索引。
- "axis"的取值范围为[-dims, dims - 1]。"dims"为"x"的维度长度。
**参数:**
- **x** (Tensor) - 输入任意维度的Tensor。将输入Tensor的shape设为 :math:`(x_1, x_2, ..., x_N)` 。数据类型为mindspore.uint16mindspore.uint32mindspore.int16mindspore.int32mindspore.float16或者mindspore.float32。
- **axis** (int) - 指定计算维度。默认值0。
- **keep_dims** (bool) - 表示是否减少维度如果为True输出将与输入保持相同的维度如果为False输出将减少维度。默认值False。
**返回:**
tuple (Tensor)表示2个Tensor组成的tuple包含对应的索引和输入Tensor的最小值。
- **index** (Tensor) - 输入Tensor最小值的索引。如果 `keep_dims` 为True则输出Tensor的shape为 :math:`(x_1, x_2, ..., x_{axis-1}, 1, x_{axis+1}, ..., x_N)` 。否则shape为 :math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`
- **output_x** (Tensor) - 输入Tensor的最小值其shape与索引相同。
**异常:**
- **TypeError** - `input_x` 的数据类型非uint16uint32int16int32float16float32。
- **TypeError** - `keep_dims` 不是bool。
- **TypeError** - `axis` 不是int。

View File

@ -236,6 +236,7 @@ Reduction Functions
mindspore.ops.logsumexp
mindspore.ops.max
mindspore.ops.norm
mindspore.ops.min
.. list-table::
:widths: 50 50

View File

@ -3856,7 +3856,7 @@ def max(x, axis=0, keep_dims=False):
Also see: class: `mindspore.ops.ArgMaxWithValue`.
Args:
x (Tensor) - The input tensor, can be any dimension. Set the shape of input tensor as
x (Tensor): The input tensor, can be any dimension. Set the shape of input tensor as
:math:`(x_1, x_2, ..., x_N)`. And the data type only support mindspore.float16 or float32.
axis (int): The dimension to reduce. Default: 0.
keep_dims (bool): Whether to reduce dimension, if true, the output will keep same dimension with the input,
@ -3909,7 +3909,7 @@ def min(x, axis=0, keep_dims=False):
Also see: class: `mindspore.ops.ArgMinWithValue`.
Args:
x (Tensor) - The input tensor, can be any dimension. Set the shape of input tensor as
x (Tensor): The input tensor, can be any dimension. Set the shape of input tensor as
:math:`(x_1, x_2, ..., x_N)` . And the data type only support
mindspore.uint16, mindspore.uint32, mindspore.int16, mindspore.int32, mindspore.float16, mindspore.float32.
axis (int): The dimension to reduce. Default: 0.
@ -3926,6 +3926,7 @@ def min(x, axis=0, keep_dims=False):
- **values** (Tensor) - The minimum value of input tensor, with the same shape as index.
Raises:
TypeError: If data type `x` is not uint16, uint32, int16, int32, float16, float32.
TypeError: If `keep_dims` is not a bool.
TypeError: If `axis` is not an int.