From baa147df7f16cc6c9833087a0f17ee28f4f3b0a1 Mon Sep 17 00:00:00 2001 From: huodagu Date: Wed, 8 Mar 2023 11:16:29 +0800 Subject: [PATCH] modify format --- docs/api/api_python/nn/mindspore.nn.AvgPool2d.rst | 2 +- docs/api/api_python/ops/mindspore.ops.AvgPool3D.rst | 2 +- .../api/api_python/ops/mindspore.ops.func_ctc_loss.rst | 4 ++-- docs/api/api_python/ops/mindspore.ops.func_lstsq.rst | 4 ++-- .../mindspore_lite/mindspore_lite.Converter.rst | 2 +- .../mindspore_lite/mindspore_lite.ModelType.rst | 4 ++-- mindspore/lite/python/api/model.py | 4 ++-- .../python/mindspore/dataset/engine/datasets_text.py | 10 +++++----- mindspore/python/mindspore/nn/layer/pooling.py | 7 ++----- mindspore/python/mindspore/ops/function/nn_func.py | 6 +++--- 10 files changed, 21 insertions(+), 24 deletions(-) diff --git a/docs/api/api_python/nn/mindspore.nn.AvgPool2d.rst b/docs/api/api_python/nn/mindspore.nn.AvgPool2d.rst index 09ff34b3a01..e643776b9b7 100644 --- a/docs/api/api_python/nn/mindspore.nn.AvgPool2d.rst +++ b/docs/api/api_python/nn/mindspore.nn.AvgPool2d.rst @@ -27,7 +27,7 @@ mindspore.nn.AvgPool2d - **data_format** (str) - 输入数据格式可为'NHWC'或'NCHW'。默认值:'NCHW'。 输入: - - **x** (Tensor) - 输入数据的shape为 :math:`(N,C_{in},H_{in},W_{in})` 或 :math:`C_{in},H_{in},W_{in})` 的Tensor。 + - **x** (Tensor) - 输入数据的shape为 :math:`(N,C_{in},H_{in},W_{in})` 或 :math:`(C_{in},H_{in},W_{in})` 的Tensor。 输出: 输出数据的shape为 :math:`(N,C_{out},H_{out},W_{out})` 或 :math:`(C_{out},H_{out},W_{out})` 的Tensor。 diff --git a/docs/api/api_python/ops/mindspore.ops.AvgPool3D.rst b/docs/api/api_python/ops/mindspore.ops.AvgPool3D.rst index 7aa10f9d778..d0a8dab939a 100644 --- a/docs/api/api_python/ops/mindspore.ops.AvgPool3D.rst +++ b/docs/api/api_python/ops/mindspore.ops.AvgPool3D.rst @@ -24,7 +24,7 @@ - **valid** - 在不填充的前提下返回有效计算所得的输出。不满足计算的多余像素会被丢弃。 - **pad** - 对输入进行填充。在输入的深度、高度和宽度方向上填充 `pad` 大小的0。如果设置此模式, `pad` 必须大于或等于0。 - - **pad** (Union(int, tuple[int])) - 池化填充方式。默认值:0。如果 `pad` 是一个整数,则头部、尾部、顶部、底部、左边和右边的填充都是相同的,等于 `pad` 。如果 `pad` 是六个integer的tuple,则头部、尾部、顶部、底部、左边和右边的填充分别等于填充pad[0]、pad[1]、pad[2]、pad[3]、pad[4]和pad[5]。 + - **pad** (Union(int, tuple[int], list[int])) - 池化填充方式。默认值:0。如果 `pad` 是一个整数,则头部、尾部、顶部、底部、左边和右边的填充都是相同的,等于 `pad` 。如果 `pad` 是六个integer的tuple,则头部、尾部、顶部、底部、左边和右边的填充分别等于填充pad[0]、pad[1]、pad[2]、pad[3]、pad[4]和pad[5]。 - **ceil_mode** (bool) - 是否使用ceil函数计算输出高度和宽度。默认值:False。 - **count_include_pad** (bool) - 如果为True,平均计算将包括零填充。默认值:True。 - **divisor_override** (int) - 如果指定了该值,它将在平均计算中用作除数,否则将使用kernel_size作为除数。默认值:0。 diff --git a/docs/api/api_python/ops/mindspore.ops.func_ctc_loss.rst b/docs/api/api_python/ops/mindspore.ops.func_ctc_loss.rst index a2c83bd807b..ea0352a98d3 100644 --- a/docs/api/api_python/ops/mindspore.ops.func_ctc_loss.rst +++ b/docs/api/api_python/ops/mindspore.ops.func_ctc_loss.rst @@ -10,8 +10,8 @@ mindspore.ops.ctc_loss 参数: - **log_probs** (Tensor) - 输入Tensor,shape :math:`(T, N, C)` 。其中T表示输入长度,N表示批次大小,C是分类数,包含空白。 - **targets** (Tensor) - 目标Tensor,shape :math:`(N, S)` 。其中S表示最大目标长度。 - - **input_lengths** (Union[tuple, Tensor]) - shape为N的Tensor或tuple。表示输入长度。 - - **target_lengths** (Union[tuple, Tensor]) - shape为N的Tensor或tuple。表示目标长度。 + - **input_lengths** (Union(tuple, Tensor)) - shape为N的Tensor或tuple。表示输入长度。 + - **target_lengths** (Union(tuple, Tensor)) - shape为N的Tensor或tuple。表示目标长度。 - **blank** (int) - 空白标签。默认值:0。 - **reduction** (str) - 对输出应用归约方法。可选值为"none"、"mean"或"sum"。默认值:"mean"。 - **zero_infinity** (bool) - 是否设置无限损失和相关梯度为零。默认值:False。 diff --git a/docs/api/api_python/ops/mindspore.ops.func_lstsq.rst b/docs/api/api_python/ops/mindspore.ops.func_lstsq.rst index 56ae4c54974..08b12070b38 100644 --- a/docs/api/api_python/ops/mindspore.ops.func_lstsq.rst +++ b/docs/api/api_python/ops/mindspore.ops.func_lstsq.rst @@ -5,14 +5,14 @@ mindspore.ops.lstsq 计算满秩矩阵 `x` :math:`(m \times n)` 与满秩矩阵 `a` :math:`(m \times k)` 的最小二乘问题或最小范数问题的解。 - 若 :math:`m \geq n` , `Lstsq` 解决最小二乘问题: + 若 :math:`m \geq n` , `lstsq` 解决最小二乘问题: .. math:: \begin{array}{ll} \min_y & \|xy-a\|_2. \end{array} - 若 :math:`m < n` , `Lstsq` 解决最小范数问题: + 若 :math:`m < n` , `lstsq` 解决最小范数问题: .. math:: \begin{array}{llll} diff --git a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.Converter.rst b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.Converter.rst index 8235e076324..fb0c00ab440 100644 --- a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.Converter.rst +++ b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.Converter.rst @@ -1,7 +1,7 @@ mindspore_lite.Converter ======================== -.. py:class:: mindspore_lite.Converter(fmk_type, model_file, output_file, weight_file="", config_file="", weight_fp16=False, input_shape=None, input_format=Format.NHWC, input_data_type=DataType.FLOAT32, output_data_type=DataType.FLOAT32, save_type=ModelType.MINDIR_LITE, decrypt_key="", decrypt_mode="AES-GCM", enable_encryption=False, encrypt_key="", infer=False, train_model=False, optimize="general", device="") +.. py:class:: mindspore_lite.Converter(fmk_type, model_file, output_file, weight_file="", config_file="", weight_fp16=False, input_shape=None, input_format=Format.NHWC, input_data_type=DataType.FLOAT32, output_data_type=DataType.FLOAT32, save_type=None, decrypt_key="", decrypt_mode="AES-GCM", enable_encryption=False, encrypt_key="", infer=False, train_model=False, optimize="general", device="") 构造 `Converter` 的类。使用场景是:1. 将第三方模型转换生成MindSpore模型或MindSpore Lite模型;2. 将MindSpore模型转换生成MindSpore Lite模型。 diff --git a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.ModelType.rst b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.ModelType.rst index dbd455f9a10..bec8e6a9a3f 100644 --- a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.ModelType.rst +++ b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.ModelType.rst @@ -7,9 +7,9 @@ mindspore_lite.ModelType 适用于以下场景: - 1. 调用 `mindspore_lite.Converter`时,设置 `save_type` 参数, `ModelType` 用于定义转换生成的模型类型。 + 1. 调用 `mindspore_lite.Converter` 时,设置 `save_type` 参数, `ModelType` 用于定义转换生成的模型类型。 - 2. 调用 `mindspore_lite.Converter`之后,当从文件加载或构建模型以进行推理时, `ModelType` 用于定义输入模型框架类型。 + 2. 调用 `mindspore_lite.Converter` 之后,当从文件加载或构建模型以进行推理时, `ModelType` 用于定义输入模型框架类型。 目前,支持以下 `ModelType` : diff --git a/mindspore/lite/python/api/model.py b/mindspore/lite/python/api/model.py index 3e03dcffbc7..9629d6625af 100644 --- a/mindspore/lite/python/api/model.py +++ b/mindspore/lite/python/api/model.py @@ -32,10 +32,10 @@ class ModelType(Enum): Used in the following scenarios: - 1. When using 'mindspore_lite.Converter', set `save_type` parameter, `ModelType` used to define the model type + 1. When using `mindspore_lite.Converter`, set `save_type` parameter, `ModelType` used to define the model type generated by Converter. - 2. After using 'mindspore_lite.Converter', when loading or building a model from file for predicting, the + 2. After using `mindspore_lite.Converter`, when loading or building a model from file for predicting, the `ModelType` is used to define Input model framework type. Currently, the following `ModelType` are supported: diff --git a/mindspore/python/mindspore/dataset/engine/datasets_text.py b/mindspore/python/mindspore/dataset/engine/datasets_text.py index 2dc50b1a03e..1f37f34608b 100644 --- a/mindspore/python/mindspore/dataset/engine/datasets_text.py +++ b/mindspore/python/mindspore/dataset/engine/datasets_text.py @@ -1100,10 +1100,10 @@ class Multi30kDataset(SourceDataset, TextBaseDataset): A source dataset that reads and parses Multi30k dataset. The generated dataset has two columns :py:obj:`[text, translation]` . - The tensor of column :py:obj:'text' is of the string type. - The tensor of column :py:obj:'translation' is of the string type. + The tensor of column :py:obj:`text` is of the string type. + The tensor of column :py:obj:`translation` is of the string type. - Args: + Args: dataset_dir (str): Path to the root directory that contains the dataset. usage (str, optional): Acceptable usages include 'train', 'test, 'valid' or 'all'. Default: 'all'. language_pair (str, optional): Acceptable language_pair include ['en', 'de'], ['de', 'en']. @@ -1384,12 +1384,12 @@ class SQuADDataset(SourceDataset, TextBaseDataset): A source dataset that reads and parses SQuAD 1.1 and SQuAD 2.0 datasets. The generated dataset with different versions and usages has the same output columns: - :py:obj:`[context, question, text, answer_start]` . + :py:obj:`[context, question, text, answer_start]` . The tensor of column :py:obj:`context` is of the string type. The tensor of column :py:obj:`question` is of the string type. The tensor of column :py:obj:`text` is the answer in the context of the string type. The tensor of column :py:obj:`answer_start` is the start index of answer in context, - which is of the uint32 type. + which is of the uint32 type. Args: dataset_dir (str): Path to the root directory that contains the dataset. diff --git a/mindspore/python/mindspore/nn/layer/pooling.py b/mindspore/python/mindspore/nn/layer/pooling.py index 5c2757940f4..726cd69fdff 100644 --- a/mindspore/python/mindspore/nn/layer/pooling.py +++ b/mindspore/python/mindspore/nn/layer/pooling.py @@ -653,7 +653,7 @@ class AvgPool2d(_PoolNd): - pad: pads the input. Pads the top, bottom, left, and right sides of the input with `padding` number of zeros. If this mode is set, `padding` must be greater than or equal to 0. - padding (Union[int, tuple[int], list[int]]): Specifies the padding value of the pooling operation. Default: 0. + padding (Union(int, tuple[int], list[int])): Specifies the padding value of the pooling operation. Default: 0. `padding` can only be an integer or a tuple/list containing one or two integers. If `padding` is an integer or a tuple/list containing one integer, it will be padded `padding` times in the four directions of the input. If `padding` is a tuple/list containing two integers, it will be padded `padding[0]` times in the @@ -666,7 +666,7 @@ class AvgPool2d(_PoolNd): Default: 'NCHW'. Inputs: - - **x** (Tensor) - Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})` or :math:`C_{in},H_{in},W_{in})`. + - **x** (Tensor) - Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})` or :math:`(C_{in},H_{in},W_{in})`. Outputs: Tensor of shape :math:`(N, C_{out}, H_{out}, W_{out})` or :math:`(C_{out},H_{out},W_{out})`. @@ -771,9 +771,6 @@ class AvgPool1d(_PoolNd): \text{output}(N_i, C_j, l) = \frac{1}{l_{ker}} \sum_{n=0}^{l_{ker}-1} \text{input}(N_i, C_j, s_0 \times l + n) - Note: - pad_mode for training only supports "same" and "valid". - Args: kernel_size (int): The size of kernel window used to take the average value, Default: 1. stride (int): The distance of kernel moving, an int number that represents diff --git a/mindspore/python/mindspore/ops/function/nn_func.py b/mindspore/python/mindspore/ops/function/nn_func.py index 3e5ba91fac0..c880bc9edc2 100644 --- a/mindspore/python/mindspore/ops/function/nn_func.py +++ b/mindspore/python/mindspore/ops/function/nn_func.py @@ -3964,10 +3964,10 @@ def ctc_loss(log_probs, targets, input_lengths, target_lengths, blank=0, reducti log_probs (Tensor): A tensor of shape (T, N, C), where T is input length, N is batch size and C is number of classes (including blank). targets (Tensor): A tensor of shape (N, S), where S is max target length, means the target sequences. - input_lengths (Union(Tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the input. - target_lengths (Union(Tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the target. + input_lengths (Union(tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the input. + target_lengths (Union(tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the target. blank (int): The blank label. Default: 0. - reduction (string): Implements the reduction method to the output with 'none', 'mean', or 'sum'. + reduction (str): Implements the reduction method to the output with 'none', 'mean', or 'sum'. Default: 'mean'. zero_infinity (bool): Whether to set infinite loss and correlation gradient to 0. Default: False.