!44907 q3_doc_collective_review_part2_master

Merge pull request !44907 from 李林杰/code_docs_1029_q3_doc_collective_review_part2_master
This commit is contained in:
i-robot 2022-11-03 08:43:22 +00:00 committed by Gitee
commit 55f61dde6b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
19 changed files with 67 additions and 60 deletions

View File

@ -8,9 +8,9 @@ mindspore.ops.BoundingBoxDecode
算子的功能是计算偏移量此算子将偏移量转换为Bbox用于在后续图像中标记目标等。
参数:
- **means** (tuple) - 计算 `deltas` 的均值。默认值0.0, 0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算 `deltas` 的标准差。默认值1.0, 1.0, 1.0, 1.0)。
- **max_shape** (tuple) - 解码框计算的上限值。
- **means** (tuple) - 计算 `deltas` 的均值。默认值0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算 `deltas` 的标准差。默认值1.0, 1.0, 1.0, 1.0)。
- **wh_ratio_clip** (float) - 解码框计算的宽高比限制。默认值0.016。
输入:

View File

@ -8,11 +8,11 @@ mindspore.ops.BoundingBoxEncode
算子的功能是计算预测边界框和真实边界框之间的偏移,并将此偏移作为损失变量。
参数:
- **means** (tuple) - 计算编码边界框的均值。默认值0.0, 0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算增量的标准偏差。默认值1.0、1.0、1.0、1.0)。
- **means** (tuple) - 计算编码边界框的均值。默认值0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算增量的标准偏差。默认值1.0, 1.0, 1.0, 1.0)。
输入:
- **anchor_box** (Tensor) - 锚框。锚框的shape必须为 :math:`(n,4)` 。
- **anchor_box** (Tensor) - 锚框。锚框的shape必须为 :math:`(n, 4)` 。
- **groundtruth_box** (Tensor) - 真实边界框。它的shape与锚框相同。
输出:

View File

@ -10,7 +10,7 @@ mindspore.ops.blackman_window
.. math::
w[n] = 0.42 - 0.5 cos(\frac{2\pi n}{N - 1}) + 0.08 cos(\frac{4\pi n}{N - 1})
\text{where : N is the full window size.}
其中N是总的窗口长度 `window_length` n为小于N的自然数 [0, 1, ..., N-1]。
参数:
- **window_length** (Tensor) - 返回窗口的大小数据类型为int32int64。输入数据的值为[0,1000000]的整数。

View File

@ -10,9 +10,9 @@ mindspore.ops.bounding_box_decode
参数:
- **anchor_box** (Tensor) - 锚框。锚框的shape必须为 :math:`(n, 4)`
- **deltas** (Tensor) - 框的增量。它的shape与 `anchor_box` 相同。
- **means** (tuple) - 计算 `deltas` 的均值。默认值0.0, 0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算 `deltas` 的标准差。默认值1.0, 1.0, 1.0, 1.0)。
- **max_shape** (tuple) - 解码框计算的上限值。
- **means** (tuple) - 计算 `deltas` 的均值。默认值0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算 `deltas` 的标准差。默认值1.0, 1.0, 1.0, 1.0)。
- **wh_ratio_clip** (float) - 解码框计算的宽高比限制。默认值0.016。
返回:

View File

@ -10,8 +10,8 @@ mindspore.ops.bounding_box_encode
参数:
- **anchor_box** (Tensor) - 锚框。锚框的shape必须为 :math:`(n, 4)`
- **groundtruth_box** (Tensor) - 真实边界框。它的shape与锚框相同。
- **means** (tuple) - 计算编码边界框的均值。默认值0.0, 0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算增量的标准偏差。默认值1.0、1.0、1.0、1.0)。
- **means** (tuple) - 计算编码边界框的均值。默认值0.0, 0.0, 0.0, 0.0)。
- **stds** (tuple) - 计算增量的标准偏差。默认值1.0, 1.0, 1.0, 1.0)。
返回:
Tensor编码边界框。数据类型和shape与输入 `anchor_box` 相同。

View File

@ -3,22 +3,22 @@ mindspore.ops.cdist
.. py:function:: mindspore.ops.cdist(x, y, p=2.0)
批量计算两个Tensor每一批次所有向量两两之间的p-范数距离。
计算两个Tensor每对列向量之间的p-norm距离。
参数:
- **x** (Tensor) - 输入tensor x输入shape [B, P, M]B维度可以为0即shape为 [P, M]。
- **y** (Tensor) - 输入tensor y输入shape [B, R, M]
- **p** (float) - P -范数距离的P值P∈[0∞]。默认值:2.0。
- **x** (Tensor) - 输入Tensorshape为 :math: `(B, P, M)` B维度为0时该维度被忽略shape为 :math:`(P, M)` 。在GPU上支持数据类型为[float32, float64]在CPU上支持[float32]。
- **y** (Tensor) - 输入Tensorshape为 :math: `(B, R, M)` ,与 `x` 的数据类型一致
- **p** (float,可选) - 计算向量对p-norm距离的P值P∈[0∞]。默认值:2.0。
返回:
Tensorp-范数距离,shape为[B, P, R]
Tensorp-范数距离,数据类型与 `x` 一致shape为(B, P, R)
异常:
- **TypeError** - `input_x``input_x` 不是Tensor。
- **TypeError** - `input_x``input_y` 的数据类型不是float16不是float32。
- **TypeError** - `x``y` 不是Tensor。
- **TypeError** - `x``y` 的数据类型在GPU环境不是float32或者float64在CPU环境不是float32。
- **TypeError** - `p` 不是float32。
- **ValueError** - `p` 是负数。
- **ValueError** - `input_x``input_y` 维度不同。
- **ValueError** - `input_x``input_y` 的维度不是2也不是3。
- **ValueError** - `x``y` 维度不同。
- **ValueError** - `x``y` 的维度不是2也不是3。
- **ValueError** - 单批次训练下 `x``y` 的shape不一样。
- **ValueError** - `x``y` 的列数不一样。

View File

@ -3,10 +3,12 @@ mindspore.ops.celu
.. py:function:: mindspore.ops.celu(x, alpha=1.0)
celu激活函数按输入元素计算输出。公式定义如下:
celu激活函数逐元素计算输入Tensor的celuContinuously differentiable exponential linear units。公式定义如下:
.. math::
\text{CeLU}(x) = \max(0,x) + \min(0, \alpha * (\exp(x/\alpha) - 1))
详情请参考: `celu <https://arxiv.org/abs/1704.07483>`_
参数:
- **x** (Tensor) - celu的输入数据类型为float16或float32。
@ -17,6 +19,6 @@ mindspore.ops.celu
异常:
- **TypeError** - `alpha` 不是float。
- **ValueError** - `alpha` 的值为零
- **TypeError** - `x` 不是tensor
- **TypeError** - `x` 的dtype既不是float16也不是float32
- **TypeError** - `x` 不是Tensor
- **TypeError** - `x` 的dtype既不是float16也不是float32
- **ValueError** - `alpha` 的值为0

View File

@ -8,7 +8,7 @@ mindspore.ops.check_valid
检查边界框的交叉数据和数据边界是否有效。
.. warning::
指定有效边界 `(长度 * 比率, 宽度 * 比率)`
`bboxes` 指定的边界 `(长度 * 比率, 宽度 * 比率)` 需要时有效的
参数:
- **bboxes** (Tensor) - shape大小为 :math:`(N, 4)`:math:`N` 表示边界框的数量, `4` 表示 `x0``x1``y0``y` 。数据类型必须是float16或float32。

View File

@ -6,7 +6,7 @@ mindspore.ops.choice_with_mask
对输入进行随机取样,返回取样索引和掩码。
输入必须是秩不小于1的Tensor。如果其秩大于等于2则第一个维度指定样本数。
索引Tensor为取样的索引掩码Tensor表示索引Tensor中的哪些元素取值为True
返回的索引Tensor为非空样本值的索引掩码Tensor说明索引Tensor中的哪些元素是有效的
参数:
- **input_x** (Tensor[bool]) - 输入Tensorbool类型。秩必须大于等于1且小于等于5。

View File

@ -3,7 +3,7 @@ mindspore.ops.cholesky
.. py:function:: mindspore.ops.cholesky(input_x, upper=False)
计算对称正定矩阵 :math:`A` 或对称正定矩阵批次的Cholesky分解。
计算对称正定矩阵 :math:`A`一批对称正定矩阵的Cholesky分解。
如果 `upper` 为True则返回的矩阵 :math:`U` 为上三角矩阵,分解形式为:
@ -26,5 +26,5 @@ mindspore.ops.cholesky
- **TypeError** - 如果 `upper` 不是bool。
- **TypeError** - 如果 `input_x` 的数据类型既不是float32也不是float64。
- **TypeError** - 如果 `input_x` 不是Tensor。
- **ValueError** - 如果 `input_x` 不是批处理方
- **ValueError** - 如果 `input_x` 不是一个或多个方阵
- **ValueError** - 如果 `input_x` 不是对称正定矩阵。

View File

@ -19,8 +19,8 @@ mindspore.ops.cholesky_inverse
输入Tensor必须是一个上三角矩阵或者下三角矩阵。
参数:
- **input_x** (Tensor) - 输入Tensor数据类型为float32或float64。
- **upper** (bool) - 是否返回上三角矩阵还是下三角矩阵的标志。默认值False。
- **input_x** (Tensor) - 输入Tensor其rank为2数据类型为float32或float64。
- **upper** (bool) - 返回上三角矩阵还是下三角矩阵的标志。默认值False。
返回:
Tensorshape和数据类型与 `input_x` 相同。

View File

@ -14,8 +14,9 @@ mindspore.ops.conv2d
如果 `pad_mode` 设置为"valid",则输出高度和宽度将分别为 :math:`\left \lfloor{1 + \frac{H_{in} + \text{padding[0]} + \text{padding[1]} - \text{kernel_size[0]} - (\text{kernel_size[0]} - 1) \times (\text{dilation[0]} - 1) }{\text{stride[0]}}} \right \rfloor`:math:`\left \lfloor{1 + \frac{W_{in} + \text{padding[2]} + \text{padding[3]} - \text{kernel_size[1]} - (\text{kernel_size[1]} - 1) \times (\text{dilation[1]} - 1) }{\text{stride[1]}}} \right \rfloor`
其中, :math:`dialtion` 为卷积核元素之间的间距, :math:`stride` 为移动步长, :math:`padding` 为添加到输入两侧的零填充。
对于取其他值的 `pad_mode` 时候的输出高度和宽度的计算,请参考 :class:`mindspore.nn.Conv2d` 里的计算公式。
请参考论文 `Gradient Based Learning Applied to Document Recognition <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_ 。更详细的介绍参见http://cs231n.github.io/convolutional-networks/。
请参考论文 `Gradient Based Learning Applied to Document Recognition <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_ 。更详细的介绍,参见: `ConvNets <http://cs231n.github.io/convolutional-networks/>`_
参数:
- **inputs** (Tensor) - shape为 :math:`(N, C_{in}, H_{in}, W_{in})` 的Tensor。

View File

@ -108,7 +108,7 @@ def check_valid(bboxes, img_metas):
Checks whether the bounding box cross data and data border are valid.
.. warning::
specifying the valid boundary (heights x ratio, weights x ratio).
Boundary(heights * ratio, widths * ratio) specified by `bboxes` is required to be valid.
Args:
bboxes (Tensor): Bounding boxes tensor with shape :math:`(N, 4)`. :math:`N` indicates the number of

View File

@ -3769,24 +3769,26 @@ def lcm(x1, x2):
def cdist(x, y, p=2.0):
"""
Computes batched the p-norm distance between each pair of the two collections of row vectors.
Computes p-norm distance between each pair of row vectors of two input Tensors.
Args:
x (Tensor): Input tensor of shape :math:`(B, P, M)`.
Letter :math:`B` represents 0 or positive int number.
When :math:`B` is equal to 0, it means this dimension can be ignored,
i.e. shape of the tensor is :math:`(P, M)`.
y (Tensor): Input tensor of shape :math:`(B, R, M)`.
p (float): P value for the p-norm distance to calculate between each vector pair, P [0,]. Default: 2.0.
i.e. shape of the tensor is :math:`(P, M)`. The supported dtype is
[float32, float64] on GPU, or [float32] on CPU.
y (Tensor): Input tensor of shape :math:`(B, R, M)`, has the same dtype as `x`.
p (float, optional): P value for the p-norm distance to calculate between each
vector pair, P [0,]. Default: 2.0.
Returns:
Tensor, has the same dtype as `x`, which shape is :math:`(B, P, R)`.
Tensor, p-norm distance, has the same dtype as `x`, its shape is :math:`(B, P, R)`.
Raises:
TypeError: If `x` or `y` is not a Tensor.
TypeError: If `x` or `y` is not Tensor.
TypeError: If dtype of x or y is not in [float32, float64] on GPU, or is not in [float32] on CPU.
TypeError: If `p` is not a float.
ValueError: If `p` is a negative float.
TypeError: If `p` is not float32.
ValueError: If `p` is negative.
ValueError: If dimension of `x` is not the same as `y`.
ValueError: If dimension of `x` or `y` is neither 2 nor 3.
ValueError: If the batch shape of `x` is not the same as the shape of `y`.
@ -6367,7 +6369,7 @@ def cholesky(input_x, upper=False):
TypeError: If `upper` is not a bool.
TypeError: If dtype of `input_x` is not one of: float64, float32.
TypeError: If `input_x` is not a Tensor.
ValueError: If `input_x` is not batch square.
ValueError: If `input_x` is not a or a batch of square matrix.
ValueError: If `input_x` is not symmetric positive definite.
Supported Platforms:
@ -6404,7 +6406,7 @@ def cholesky_inverse(input_x, upper=False):
The input must be either an upper triangular matrix or a lower triangular matrix.
Args:
input_x (Tensor): The input tensor. Types: float32, float64.
input_x (Tensor): The input tensor with a rank of 2. Supported dtypes: float32, float64.
upper(bool): Whether to return a lower or upper triangular matrix. Default: False.
Returns:

View File

@ -1009,15 +1009,14 @@ def dropout(x, p=0.5, seed0=0, seed1=0):
def celu(x, alpha=1.0):
r"""
Computes celu (Continuously differentiable exponential linear units) of input tensors element-wise.
celu activation function, computes celu (Continuously differentiable exponential
linear units) of input tensors element-wise. The formula is defined as follows:
.. math::
\text{CeLU}(x) = \max(0,x) + \min(0, \alpha * (\exp(x/\alpha) - 1))
It returns :math:`\max(0,x) + \min(0, \alpha * (\exp(x/\alpha) - 1))` element-wise.
The picture about celu looks like this `celu <https://arxiv.org/abs/1704.07483>`_.
For more details, please refer to `celu <https://arxiv.org/abs/1704.07483>`_.
Args:
x (Tensor): The input of celu with data type of float16 or float32.
@ -1028,9 +1027,9 @@ def celu(x, alpha=1.0):
Raises:
TypeError: If `alpha` is not a float.
ValueError: If `alpha` has the value of 0.
TypeError: If `x` is not a Tensor.
TypeError: If dtype of `x` is neither float16 nor float32.
ValueError: If `alpha` has the value of 0.
Supported Platforms:
``Ascend`` ``CPU`` ``GPU``
@ -3102,15 +3101,16 @@ def conv2d(inputs, weight, pad_mode="valid", padding=0, stride=1, dilation=1, gr
out_j = \sum_{i=0}^{C_{in} - 1} ccor(W_{ij}, X_i) + b_j,
where :math:`ccor` is the cross correlation operator, :math:`C_{in}` is the input channel number, :math:`j` ranges
where :math:`ccor` is the `cross-correlation <https://en.wikipedia.org/wiki/Cross-correlation>`_ operator,
:math:`C_{in}` is the input channel number, :math:`j` ranges
from :math:`0` to :math:`C_{out} - 1`, :math:`W_{ij}` corresponds to the :math:`i`-th channel of the :math:`j`-th
filter and :math:`out_{j}` corresponds to the :math:`j`-th channel of the output. :math:`W_{ij}` is a slice
of kernel and it has shape :math:`(\text{kernel_size[0]}, \text{kernel_size[1]})`, where :math:`\text{
kernel_size[0]}` and :math:`\text{kernel_size[1]}` are the height and width of the convolution kernel.
The full kernel has shape :math:`(C_{out}, C_{in} / \text{group}, \text{kernel_size[0]}, \text{kernel_size[1]})`,
where group is the group number to split the input in the channel dimension.
where `group` is the group number to split the input in the channel dimension.
If the 'pad_mode' is set to be "valid", the output height and width will be
If the `pad_mode` is set to be "valid", the output height and width will be
:math:`\left \lfloor{
1 + \frac{H_{in} + \text{padding[0]} + \text{padding[1]} - \text{kernel_size[0]} -
(\text{kernel_size[0]} - 1) \times(\text{dilation[0]} - 1)} {\text { stride[0] }}} \right \rfloor` and
@ -3121,10 +3121,12 @@ def conv2d(inputs, weight, pad_mode="valid", padding=0, stride=1, dilation=1, gr
Where :math:`dilation` is Spacing between kernel elements, :math:`stride` is The step length of each step,
:math:`padding` is zero-padding added to both sides of the input.
For output height and width on other `pad_mode`, please refer to formula on `mindspore.nn.Conv2d
<https://www.mindspore.cn/docs/en/master/api_python/nn/mindspore.nn.Conv2d.html>`_.
The first introduction can be found in paper `Gradient Based Learning Applied to Document Recognition
<http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_. More detailed introduction can be found here:
http://cs231n.github.io/convolutional-networks/.
`ConvNets <http://cs231n.github.io/convolutional-networks/>`_ .
Args:
inputs (Tensor): Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})`.
@ -3487,7 +3489,7 @@ def bias_add(input_x, bias):
def binary_cross_entropy(logits, labels, weight=None, reduction='mean'):
r"""
Computes the binary cross entropy between predivtive value `logits` and target value `labels`.
Computes the binary cross entropy between predictive value `logits` and target value `labels`.
Set `logits` as :math:`x`, `labels` as :math:`y`, output as :math:`\ell(x, y)`, the
weight of nth batch of binary cross entropy is :math:`w_n`.
@ -3512,7 +3514,7 @@ def binary_cross_entropy(logits, labels, weight=None, reduction='mean'):
- The value of `labels` must be `0` or `l`.
Args:
logits (Tensor): The predivtive value whose data type must be float16 or float32,
logits (Tensor): The predictive value whose data type must be float16 or float32.
The shape is :math:`(N, *)` where :math:`*` means, any number of additional dimensions.
labels (Tensor): The target value which has the same shape and data type as `logits`.
weight (Tensor, optional): A rescaling weight applied to the loss of each batch element.

View File

@ -482,10 +482,10 @@ def choice_with_mask(input_x, count=256, seed=0, seed2=0):
"""
Generates a random sample as index tensor with a mask tensor from a given tensor.
The input_x must be a tensor of rank not less than 1. If its rank is greater than or equal to 2,
The `input_x` must be a tensor whose rank is not less than 1. If its rank is greater than or equal to 2,
the first dimension specifies the number of samples.
The index tensor and the mask tensor have the fixed shapes. The index tensor denotes the index of the nonzero
sample, while the mask tensor denotes which elements in the index tensor are valid.
The returned index tensor denotes the index of the nonzero
sample, the mask tensor denotes which elements in the index tensor are valid.
Args:
input_x (Tensor[bool]): The input tensor.

View File

@ -24,8 +24,8 @@ def blackman_window(window_length, periodic=True, *, dtype=None):
r"""
Blackman window function.
The input `window_length` is a tensor that datatype must be a integer, which
controlling the returned window size. In particular, If `window_length` is equal to `1`,
The input `window_length` is a tensor with datatype int,
it determines the returned window size. In particular, if `window_length` is equal to `1`,
the returned window contains a single value `1`.
Attr `periodic` determines whether the returned window trims off the last duplicate value
from the symmetric window and is ready to be used as a periodic window with functions.
@ -35,7 +35,7 @@ def blackman_window(window_length, periodic=True, *, dtype=None):
w[n] = 0.42 - 0.5 cos(\frac{2\pi n}{N - 1}) + 0.08 cos(\frac{4\pi n}{N - 1})
\text{where : N is the full window size.}
where N is the full window size, and n is natural number less than N:[0, 1, ..., N-1].
Args:
window_length (Tensor): the size of returned window, with data type int32, int64.

View File

@ -5614,7 +5614,7 @@ class BinaryCrossEntropy(Primitive):
Its value must be one of 'none', 'mean' or 'sum'. Default: 'mean'.
Inputs:
- **logits** (Tensor) - The predivtive value whose data type must be float16 or float32,
- **logits** (Tensor) - The predictive value whose data type must be float16 or float32,
The shape is :math:`(N, *)` where :math:`*` means, any number of additional dimensions.
- **labels** (Tensor) - The target value which has the same shape and data type as `logits`.
- **weight** (Tensor, optional) - A rescaling weight applied to the loss of each batch element.

View File

@ -224,9 +224,9 @@ class BoundingBoxDecode(Primitive):
which is used to mark the target in the subsequent images, etc.
Args:
max_shape (tuple): The max size limit for decoding box calculation.
means (tuple): The means of deltas calculation. Default: (0.0, 0.0, 0.0, 0.0).
stds (tuple): The standard deviations of deltas calculation. Default: (1.0, 1.0, 1.0, 1.0).
max_shape (tuple): The max size limit for decoding box calculation.
wh_ratio_clip (float): The limit of width and height ratio for decoding box calculation. Default: 0.016.
Inputs: