Merge pull request !48829 from 于振华/code_docs_api_doc_230213
This commit is contained in:
i-robot 2023-02-15 09:04:51 +00:00 committed by Gitee
commit 86e725da91
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 33 additions and 31 deletions

View File

@ -3,15 +3,18 @@ mindspore.ops.bincount
.. py:function:: mindspore.ops.bincount(x, weights=None, minlength=0)
计算非负整数数组中每个值的出现次数。大小为1的bins的数量为 `x` 中的最大值加1。
如果指定了 `minlength`则输出数组中至少会有此数量的bins如果需要它会更长具体取决于 `x` 的内容)。
每个bin给出其索引值在 `x` 中的出现次数。如果指定了 `weights`,则输入数组由其加权,即如果在位置 `i` 处的值 `n`,则 `out[n]+=weight[i]` 而不是 `out[n]+=1`
统计 `x` 中每个值的出现次数。
如果不指定 `minlength` 输出Tensor的长度为输入 `x` 中最大值加1。
如果指定了 `minlength`则输出Tensor的长度为 `x` 中最大值加1和 `minlength` 的最大值。
输出Tensor中每个值标记了该索引值在 `x` 中的出现次数。如果指定了 `weights`,对输出的结果进行加权处理,即 `out[n]+=weight[i]` 而不是 `out[n]+=1`
参数:
- **x** (Tensor) - 一维的Tensor。
- **weights** (Tensor, 可选) - 权重,与 `x` shape相同的tensor。默认值None。
- **minlength** (int, 可选) - 输出Tensor的最小bin的数量。默认值0。
- **weights** (Tensor, 可选) - 权重,与 `x` shape相同。默认值None。
- **minlength** (int, 可选) - 输出Tensor的最小长度。默认值0。
返回:
Tensor如果输入为非空输出shape为[max(input)+1]的Tensor否则shape为[0]。

View File

@ -3,15 +3,15 @@ mindspore.ops.chunk
.. py:function:: mindspore.ops.chunk(x, chunks, axis=0)
根据指定的轴将输入Tensor切分成块
沿着指定轴 `axis` 将输入Tensor切分成 `chunks` 个sub-tensor
.. note::
此函数返回的数量可能小于通过 `chunks` 指定的数量!
参数:
- **x** (Tensor) - Tensor的shape为 :math:`(x_1, x_2, ..., x_R)`
- **chunks** (int) - 要返回的块数
- **axis** (int) - 指定分割轴。默认值0。
- **x** (Tensor) - 被切分的Tensor。
- **chunks** (int) - 要切分的sub-tensor数量
- **axis** (int) - 指定需要分割的维度。默认值0。
返回:
tuple[Tensor]。

View File

@ -3,10 +3,10 @@ mindspore.ops.full_like
.. py:function:: mindspore.ops.full_like(x, fill_value, *, dtype=None)
返回一个与输入相同大小的Tensor填充 `fill_value``ops.full_like(x, fill_value)` 相当于 `ops.full(x.shape, fill_value, dtype=x.dtype)`
返回一个shape与 `x` 相同并且使用 `fill_value` 填充的Tensor
参数:
- **x** (Tensor) - `x` 的shape决定输出Tensor的shape。
- **x** (Tensor) - 输入Tensor输出Tensor与 `x` 具有相同的shape。
- **fill_value** (number.Number) - 用来填充输出Tensor的值。当前不支持复数类型。
关键字参数:

View File

@ -3,8 +3,7 @@ mindspore.ops.tril
.. py:function:: mindspore.ops.tril(input_x, diagonal=0)
返回单个矩阵二维Tensor或批次输入矩阵的下三角形部分其他位置的元素将被置零。
矩阵的下三角形部分定义为对角线本身和对角线以下的元素。
返回输入Tensor `input_x` 的下三角形部分(包含对角线和下面的元素)并将其他元素设置为0。
参数:
- **input_x** (Tensor) - 输入Tensor。shape为 :math:`(x_1, x_2, ..., x_R)` 其rank至少为2。

View File

@ -717,11 +717,10 @@ def full(size, fill_value, *, dtype=None): # pylint: disable=redefined-outer-nam
def full_like(x, fill_value, *, dtype=None):
"""
Returns a Tensor with the same size as `x` filled with `fill_value`. `ops.full_like(x, fill_value)` is
equivalent to `ops.full(x.shape, fill_value, dtype=x.dtype)` .
Return a Tensor of the same shape as `x` and filled with `fill_value`.
Args:
x (Tensor): The shape of `x` will determine shape of the output Tensor.
x (Tensor): input Tensor and the output Tensor have the same shape as `x`.
fill_value (number.Number): Value to fill the returned Tensor. Complex numbers are not supported for now.
Keyword Args:
@ -757,15 +756,15 @@ def full_like(x, fill_value, *, dtype=None):
def chunk(x, chunks, axis=0):
"""
Splits the Tensor into chunks along the given axis.
Cut the input Tensor into `chunks` sub-tensors along the specified axis.
Note:
This function may return less then the specified number of chunks!
Args:
x (Tensor): A Tensor to be divided.
chunks (int): Number of chunks to return.
axis (int): The axis along which to split. Default: 0.
x (Tensor): A Tensor to be cut.
chunks (int): Number of sub-tensors to cut.
axis (int): Specify the dimensions that you want to split. Default: 0.
Returns:
A tuple of sub-tensors.
@ -5059,9 +5058,8 @@ def split(x, split_size_or_sections, axis=0):
def tril(input_x, diagonal=0): # pylint: disable=redefined-outer-name
"""
Returns the lower triangular part of the matrix (2-D tensor) or batch of matrices input,
the other elements of the result tensor out are set to 0.
The lower triangular part of the matrix is defined as the elements on and below the diagonal.
Returns the lower triangle part of 'input_x' (elements that contain the diagonal and below),
and set the other elements to zeros.
Args:
input_x (Tensor): A Tensor with shape :math:`(x_1, x_2, ..., x_R)`. The rank must be at least 2.

View File

@ -421,13 +421,15 @@ def angle(x):
def bincount(x, weights=None, minlength=0):
"""
Count number of occurrences of each value in array of non-negative ints.
The number of bins (of size 1) is one larger than the largest value in `x`.
If `minlength` is specified, there will be at least this number of bins in the
output array (though it will be longer if necessary, depending on the contents
of `x`). Each bin gives the number of occurrences of its index value in `x`. If
`weights` is specified the input array is weighted by it, i.e. if a value `n`
is found at position `i`, ``out[n] += weight[i]`` instead of ``out[n] += 1``.
Counts the number of occurrences of each value in `x`.
If you don't specify 'minlength', the length of output Tensor will be
the maximum value of the input 'x' plus one.
If `minlength` is specified, the length of output Tensor is the value of maximum of `x` plus 1 and `minlength`.
Each value in the output Tensor marks the number of occurrences of that index in 'x'.
If 'weights' is specified, the output results are weighted, i.e ``out[n] += weight[i]`` instead of ``out[n] += 1``.
Args:
x (Tensor): 1-d input tensor.