!45871 modify the format of files 1122

Merge pull request !45871 from 宦晓玲/code_docs_1122
This commit is contained in:
i-robot 2022-11-23 08:51:32 +00:00 committed by Gitee
commit 2e182dabd8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
16 changed files with 52 additions and 67 deletions

View File

@ -3,4 +3,4 @@ mindspore.Tensor.i0
.. py:method:: mindspore.Tensor.i0()
:func:`mindspore.Tensor.bessel_i0` 的别名
详情请参考 :func:`mindspore.ops.i0`

View File

@ -20,7 +20,7 @@ mindspore.CSRTensor
如果 `indptr``indices` 的值不合法,行为将没有定义。不合法的值包括当 `values``indices` 的长度超出了 `indptr` 所指定的取值范围,以及当 `indices` 在同一行中出现重复的列。
参数:
- **indptr** (Tensor) - shape为 :math:`(M)` 的一维整数Tensor其中M等于 `shape[0] + 1` , 表示每行非零元素的在 `values` 中存储的起止位置。默认值None。支持的数据类型为int16int32和int64。
- **indptr** (Tensor) - shape为 :math:`(M)` 的一维整数Tensor其中M等于 `shape[0] + 1` 表示每行非零元素的在 `values` 中存储的起止位置。默认值None。支持的数据类型为int16int32和int64。
- **indices** (Tensor) - shape为 :math:`(N)` 的一维整数Tensor其中N等于非零元素数量表示每个元素的列索引值。默认值None。支持的数据类型为int16 int32和int64。
- **values** (Tensor) - Tensorvalues的0维长度必须与indices的0维长度相等(values.shape[0] == indices.shape[0])。values用来表示索引对应的数值。默认值None。
- **shape** (tuple(int)) - shape为ndims的整数元组用来指定稀疏矩阵的稠密shape。`shape[0]` 表示行数,因此必须和 `M - 1` 值相等。默认值None。

View File

@ -12,7 +12,7 @@
- **x** (Tensor) - 复数Tensor格式须为complex64或complex128。
输出:
Tensor。如果 `x` 的类型是complex64 `y` 的类型是float32如果 `x` 的类型是complex128`y` 的类型是float64。
Tensor。如果 `x` 的类型是complex64输出的类型是float32如果 `x` 的类型是complex128则输出的类型是float64。
异常:
- **TypeError** - 输入 `x` 不是Tensor。

View File

@ -11,12 +11,12 @@
.. warning::
此算子为实验性算子,将来可能面临更改或删除。
输入:
输入
- **x** (Tensor) - 输入Tensor。数据类型为 `float16``float32` 或者 `float64`
输出:
输出
Tensor, 和输入 `x` 具有相同的数据类型。
异常:
异常
- **TypeError** - 如果输入 `x` 不是Tensor。
- **TypeError** - 输入输入 `x` 的数据类型不是 `float16``float32` 或者 `float64`

View File

@ -8,11 +8,11 @@
参数:
- **compute_v** (bool可选) - 如果为True同时计算特征值和特征向量如果为False只计算特征值默认值False。
输入:
输入
- **x** (Tensor) - 方阵。shape为 :math:`(*, N, N)`,数据类型支持
float32、float64、complex64、complex128。
输出:
输出
- **eigen_values** (Tensor) - shape为 :math:`(*, N)`,其中的每个向量代表对应矩阵的特征值,特征值之间没有顺序关系。
- **eigen_vectors** (Tensor) - 如果 `compute_v` 为False此为空Tensor否则为shape :math:`(*, N, N)` 的Tensor。
其列表示相应特征值的规范化(单位长度)特征向量。

View File

@ -12,10 +12,10 @@ mindspore.ops.FractionalMaxPoolWithFixedKsize
详细内容请参考论文 `Fractional Max-Pooling <https://arxiv.org/pdf/1412.6071>`_
参数:
- **ksize** (Union[float, tuple]) - 用于取最大值的内核窗口的大小。目标 ksize 为 `H x W` 。ksize 可以是元组,也可以是 `K x K` 的单个K。
- **ksize** (Union[int, tuple[int]]) - 用于取最大值的内核窗口的大小。目标 ksize 为 `H x W` 。ksize 可以是元组,也可以是 `K x K` 的单个K。
指明了输入Tensor的窗口大小 `(H, W)`
- **output_shape** (Union[int, tuple]) - 目标输出shape为 `H x W` 输出shape可以是一个元组或者 `H x H` 的单个H。
- **output_shape** (Union[int, tuple[int]]) - 目标输出shape为 `H x W` 输出shape可以是一个元组或者 `H x H` 的单个H。
指明了输出tensor的大小 `(H, W)`
- **data_format** (str可选) - 可选的数据格式值,当前支持 `NCHW` ,默认为 `NCHW`

View File

@ -14,6 +14,6 @@ mindspore.ops.MatrixLogarithm
异常:
- **TypeError** - 如果 `x` 不是Tensor。
- **ValueError** - 如果 `x` 的数据类型不是complex64或complex128。
- **TypeError** - 如果 `x` 的数据类型不是complex64或complex128。
- **ValueError** - 如果 `x` 的维度小于2。
- **ValueError** - 如果内部的两维不相等。

View File

@ -31,7 +31,7 @@ mindspore.ops.MaxUnpool2D
- 如果 `pads` 是一个整数,则高度和宽度方向的填充数量相同,都等于 `pads`
- 如果 `pads` 是含两个整数的元组,高度和宽度方向的填充数量分别等于 `pads[0]``pads[1]`
- **output_shape** (tuple[int],可选) 一个可选的输入,指定目标输出的尺寸。默认值:()。
- **output_shape** (tuple[int],可选) - 一个可选的输入,指定目标输出的尺寸。默认值:()。
- 如果 `output_shape == ()` 则输出的shape由 `kszie``strides``pads` 计算得到。
- 如果 :math:`output_shape != ()` ,则 `output_shape` 必须为 :math:`(N, C, H, W)`:math:`(N, H, W, C)`

View File

@ -27,12 +27,12 @@ mindspore.ops.ScaleAndTranslate
- **TypeError** - `antialias` bool类型。
- **TypeError** - `images` 数据类型无效。
- **TypeError** - `size` 不是int32类型。
- **TypeError** - `scale` 不是float32类型
- **TypeError** - `scale` 不是float32类型。
- **TypeError** - `translation` 不是Tensor或者数据类型不是float32。
- **ValueError** - `kernel_type` 不在列表里面:["lanczos1", "lanczos3", "lanczos5", "gaussian", "box", "triangle",
"keyscubic", "mitchellcubic"]。
- **ValueError** - `images` 的秩不等于4。
- **ValueError** - `size` 的shape不是 :math:`(2,)`
- **ValueError** - `scale` 的shape不是 :math:`(2,)`
- **ValueError** - `translation` 的shape不是 :math:`(2,)`
- **ValueError** - `scale` 的shape不是 :math:`(2,)`
- **ValueError** - `translation` 的shape不是 :math:`(2,)`

View File

@ -10,13 +10,13 @@ mindspore.ops.pad
- **padding** (Union[tuple[int], list[int], Tensor]) - pad的填充位置。
:math:`\left\lfloor\frac{\text{len(padding)}}{2}\right\rfloor` 维度的 `input_x` 将会被填充。
- 示例若只需要填充输入tensor的最后一个维度`padding` 则的填充方式为:math:`(\text{padding\_left}, \text{padding\_right})`;
- 示例若只需要填充输入tensor的最后两个维度`padding` 则的填充方式为:math:`(\text{padding\_left}, \text{padding\_right}, \text{padding\_top}, \text{padding\_bottom})`;
- 示例若只需要填充输入tensor的最后三个维度`padding` 则的填充方式为:math:`(\text{padding\_left}, \text{padding\_right}, \text{padding\_top}, \text{padding\_bottom}, \text{padding\_front}, \text{padding\_back}))`;
- 示例若只需要填充输入tensor的最后一个维度`padding` 则的填充方式为 :math:`(\text{padding\_left}, \text{padding\_right})`;
- 示例若只需要填充输入tensor的最后两个维度`padding` 则的填充方式为 :math:`(\text{padding\_left}, \text{padding\_right}, \text{padding\_top}, \text{padding\_bottom})`;
- 示例若只需要填充输入tensor的最后三个维度`padding` 则的填充方式为 :math:`(\text{padding\_left}, \text{padding\_right}, \text{padding\_top}, \text{padding\_bottom}, \text{padding\_front}, \text{padding\_back}))`;
以此类推。
- **mode** (str可选) - Pad的填充模式可选择 "constant", "reflect" 或者 "replicate"。 默认值: "constant"。
- **mode** (str可选) - Pad的填充模式可选择 "constant", "reflect" 或者 "replicate"。默认值:"constant"。
- 对于 "constant" 模式,请参考 :class:`mindspore.nn.ConstantPad1d` 作为示例来理解这个填充模式并将这个模式扩展到n维。
- 对于 "reflect" 模式,请参考 :class:`mindspore.nn.ReflectionPad1d` 作为示例来理解这个填充模式并将这个模式扩展到n维。

View File

@ -558,10 +558,10 @@ class CSRTensor(CSRTensor_):
Args:
indptr (Tensor): 1-D Tensor of shape `[M]`, which equals to `shape[0] + 1`, which indicates the
start and end point for `values` in each row. Default: None. If provided,
must be :class:`mindspore.int16`, :class:`mindspore.int32` or :class:`mindspore.int64`.
must be int16, int32 or int64.
indices (Tensor): 1-D Tensor of shape `[N]`, which has the same length as `values`. `indices`
indicates the which column `values` should be placed. Default: None. If provided,
must be :class:`mindspore.int16`, :class:`mindspore.int32` or :class:`mindspore.int64`.
must be int16, int32 or int64.
values (Tensor): Tensor, which has the same length as `indices` (values.shape[0] == indices.shape[0]).
`values` stores the data for CSRTensor. Default: None.
shape (tuple(int)): A tuple indicates the shape of the CSRTensor, and `shape[0]` must equal to `M - 1`,

View File

@ -178,26 +178,7 @@ class Expand(Primitive):
"""
Returns a new view of the self tensor with singleton dimensions expanded to a larger size.
Note:
Passing -1 as the size for a dimension means not changing the size of that dimension.
Tensor can be also expanded to a larger number of dimensions, and the new ones will be appended at the front.
For the new dimensions, the size cannot be set to -1.
Inputs:
- **x** (Tensor) - The shape of tensor is (x_1, x_2, ..., x_R).
- **shape** (Tensor) - The new shape of x.
Outputs:
- **y** (Tensor) - Tensor after expansion.
Raises:
TypeError: If any input is not Tensor.
TypeError: If the type of `shape` is not one of the following dtype: int16, int32, int64.
ValueError: If `shape` is not a 1-D tensor.
ValueError: If the size of `shape` is less than the size of `x.shape`.
ValueError: If the expanded `shape` is not equal to the existing shape of `x` at a dimension that is not 1.
ValueError: If the expanded size < 0 and it is in a leading, non-existing dimension.
ValueError: If the number of elements of output is more than 1000000.
Refer to :func:`mindspore.ops.expand` for more details.
Supported Platforms:
``Ascend`` ``CPU``
@ -560,11 +541,11 @@ class Col2Im(Primitive):
Args:
kernel_size (Union[int, tuple[int], list[int]]): The size of the kernel, should be two positive int
for height and width. If type is int, it means that height equal with width. Must be specified.
dilation (Union[int, tuple[int], list[int]]): The size of the dilation, should be two positive int
dilation (Union[int, tuple[int], list[int]], optional): The size of the dilation, should be two positive int
for height and width. If type is int, it means that height equal with width. Default: 1.
padding (Union[int, tuple[int], list[int]]): The size of the padding, should be two int
padding (Union[int, tuple[int], list[int]], optional)): The size of the padding, should be two int
for height and width. If type is int, it means that height equal with width. Default: 0.
stride (Union[int, tuple[int], list[int]]): The size of the stride, should be two positive int
stride (Union[int, tuple[int], list[int]], optional)): The size of the stride, should be two positive int
for height and width. If type is int, it means that height equal with width. Default: 1.
Inputs:
@ -3780,7 +3761,7 @@ class ResizeNearestNeighborV2(Primitive):
tensors are aligned, preserving the values at the corner pixels. Defaults: False.
half_pixel_centers (bool, optional): Whether half pixel center. If set to True,
`align_corners` should be False. Default: False.
data_format (string, optional): An optional `string` that describes the
data_format (str, optional): An optional `string` that describes the
format of the input `x`. Default: `NHWC`.
Inputs:
@ -5707,7 +5688,7 @@ class Sort(Primitive):
"""
Sorts the elements of the input tensor along the given dimension in the specified order.
Refer to :func:'mindspore.ops.sort' for more details.
Refer to :func:`mindspore.ops.sort` for more details.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``

View File

@ -1077,10 +1077,11 @@ class CombinedNonMaxSuppression(Primitive):
Greedily selects a subset of bounding boxes in descending order of score.
Args:
clip_boxes (bool): If true, assume the box coordinates are between [0, 1] and clip the output boxes
clip_boxes (bool, optional): If true, assume the box coordinates are between [0, 1] and clip the output boxes
if they fall beyond [0, 1]. If false, do not do clipping and output the box coordinates as it is.
Defaults to true.
pad_per_class (bool): If false, the output nmsed boxes, scores and classes are padded/clipped to max_total_size.
pad_per_class (bool, optional): If false, the output nmsed boxes,
scores and classes are padded/clipped to max_total_size.
If true, the output nmsed boxes, scores and classes are padded to be of length
max_size_per_class * num_classes, unless it exceeds max_total_size in which case it is clipped to
max_total_size. Defaults to false.

View File

@ -2693,7 +2693,7 @@ class Histogram(Primitive):
Elements lower than min and higher than max are ignored.
Args:
bins (int, optional) : Number of histogram bins, optional. Default 100. If specified, must be positive.
bins (int, optional): Number of histogram bins, optional. Default 100. If specified, must be positive.
min (float, optional): An optional float of the lower end of the range (inclusive). Default value is 0.0.
max (float, optional): An optional float of the upper end of the range (inclusive). Default value is 0.0.
@ -5622,7 +5622,7 @@ class MatrixLogarithm(Primitive):
Must be one of the following types:complex64, complex128. And shape must be 2D-7D.
Outputs:
- **y** (Tensor), has the same shape and type as input.
- **y** (Tensor) - has the same shape and type as input.
Raises:
TypeError: If `x` is not a Tensor.
@ -5803,8 +5803,8 @@ class ComplexAbs(Primitive):
- **x** (Tensor) - A Tensor, types: complex64, complex128.
Outputs:
- **y** (Tensor) - Tensor, has the same shape as x. If the type of x is complex64, the type of y is float32.
If the type of x is complex128, the type of y is float64.
Tensor, has the same shape as x. If the type of x is complex64, the type of output is float32.
If the type of x is complex128, the type of output is float64.
Raises:
TypeError: If the input is not a Tensor.
@ -6593,17 +6593,17 @@ class RaggedRange(Primitive):
"""
Returns a `RaggedTensor` containing the specified sequences of numbers.
Args:
Args:
Tsplits (mindspore.dtype): An mindspore.dtype from: mindspore.int32, mindspore.int64.
Inputs:
Inputs:
- **starts** (Tensor) - The starts of each range, whose type is int32, int64, float32 or float64,
and shape is 0D or 1D.
- **limits** (Tensor) - The limits of each range, whose type and shape should be same as input `starts`.
- **deltas** (Tensor) - The deltas of each range, whose type and shape should be same as input `starts`,
and each element in the tensor should not be equal to 0.
Outputs:
Outputs:
- **rt_nested_splits** (Tensor) - The nested splits of the return `RaggedTensor`,
and type of the tensor is `Tsplits`,
shape of the tensor is equal to shape of input `starts` plus 1.
@ -7547,7 +7547,7 @@ class Eig(Primitive):
Computes the eigenvalues and eigenvectors of a square matrix(batch square matrices).
Args:
compute_v (bool): If `True`, compute both eigenvalues and eigenvectors;
compute_v (bool, optional): If `True`, compute both eigenvalues and eigenvectors;
If `False`, just eigenvalues will be computed. Default: False.
Inputs:
- **x** (Tensor) - Square matrices of shape :math:`(*, N, N)`,

View File

@ -8270,7 +8270,7 @@ class Dilation2D(Primitive):
each sampling location. Its value must be greater or equal to 1 and bounded by
the height and width of the input `x`.
pad_mode (str): Specifies padding mode. The optional values are
pad_mode (str, optional): Specifies padding mode. The optional values are
"same", "valid". Default: "same". Both upper and lower case are supported.
- same: Adopts the way of completion. The height and width of the output will be the same as
@ -8278,7 +8278,7 @@ class Dilation2D(Primitive):
- valid: Adopts the way of discarding. The possible largest height and width of output will be returned
without padding. Extra pixels will be discarded.
data_format (str): The value for data format, only 'NCHW' is supported at present. Default: "NCHW".
data_format (str, optional): The value for data format, only 'NCHW' is supported at present. Default: "NCHW".
Inputs:
- **x** (Tensor) - Input data. A four dimension tensor with float16 or float32 data type. The shape must be
@ -9146,13 +9146,12 @@ class FractionalMaxPool3DWithFixedKsize(Primitive):
Supported shape :math:`(N, C, 3)`
Outputs:
Outputs:
- **y** (Tensor) - A tensor, the output of FractionalMaxPool3DWithFixedKsize.
Has the same data type with `x`.
Tensor of shape :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(N, D_{out}, H_{out}, W_{out}, C)`.
Has the same data type with `x`.
Tensor of shape :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(N, D_{out}, H_{out}, W_{out}, C)`.
- **argmax** (Tensor) - A tensor, the indices along with the outputs.
Has the same shape as the `y` and int32 or int64 data type.
Has the same shape as the `y` and int32 or int64 data type.
Raises:
TypeError: If `input_x` is not a 4D or 5D tensor.
@ -9567,15 +9566,19 @@ class DeformableOffsets(Primitive):
class GridSampler2D(Primitive):
"""
This operation samples 2d input_x by using interpolation based on flow field grid, which is usually gennerated by
This operation samples 2d input_x by using interpolation based on flow field grid,
which is usually gennerated by
affine_grid.
Args:
interpolation_mode (str): An optional string specifying the interpolation method. The optional values are
interpolation_mode (str, optional): An optional string specifying the interpolation method.
The optional values are
"bilinear" or "nearest". Default: "bilinear".
padding_mode (str): An optional string specifying the pad method. The optional values are "zeros", "border" or
padding_mode (str, optional): An optional string specifying the pad method.
The optional values are "zeros", "border" or
"reflection". Default: "zeros".
align_corners (bool): An optional bool. When set to True, the centers of the corner pixels of the input
align_corners (bool, optional): An optional bool. When set to True,
the centers of the corner pixels of the input
and output tensors are aligned. When set to False, it is not aligned. Defaults to False.
Inputs:

View File

@ -90,7 +90,7 @@ class TruncatedNormal(Primitive):
dtype (mindspore.dtype): Specified output data type. Must be one of the following types:
mindspore.float16, mindspore.float32 and mindspore.float64. Default: mindspore.float32.
Inputs
Inputs:
- **shape** (Tensor) - The shape of random tensor to be generated. Its type must be one of the following types:
mindspore.int32 and mindspore.int64.