From 83a532b2e3c14f7343ecf32e4d19578445df9226 Mon Sep 17 00:00:00 2001 From: huodagu Date: Mon, 24 Oct 2022 17:33:06 +0800 Subject: [PATCH] modify format --- docs/api/api_python/mindspore.rewrite.rst | 6 +++--- .../mindspore/dataset/engine/datasets_vision.py | 2 +- mindspore/python/mindspore/nn/layer/pooling.py | 4 ++-- mindspore/python/mindspore/nn/loss/loss.py | 2 +- .../python/mindspore/ops/function/array_func.py | 6 +++--- mindspore/python/mindspore/profiler/profiling.py | 4 ++-- .../python/mindspore/rewrite/api/symbol_tree.py | 13 +++++++------ 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/api/api_python/mindspore.rewrite.rst b/docs/api/api_python/mindspore.rewrite.rst index 70d96eb4ca0..0f62b6c6328 100644 --- a/docs/api/api_python/mindspore.rewrite.rst +++ b/docs/api/api_python/mindspore.rewrite.rst @@ -53,15 +53,15 @@ mindspore.rewrite 异常: - **TypeError** - 参数 `network` 不是Cell类型对象。 - .. py:method:: mindspore.rewrite.SymbolTree.create_call_function(self, func, targets, args, kwargs) + .. py:method:: mindspore.rewrite.SymbolTree.create_call_function(func, targets, args, kwargs) 创建一个Node对象,并生成执行代码插入源码中。源码中以 `args` 和 `kwargs` 为参数调用 `func` 函数。 参数: - **func** (FunctionType) - 要被调用的函数。 - - **targets** (list[str]) - 表示输出名称。在源代码中作为节点的输出。 + - **targets** (list[str]) - 表示输出名称。在源代码中作为节点的输出。 - **args** (Union[MsDtypes, ParamTypes]) - 该节点的参数名称。用作源代码中代码语句的参数。默认为None表示 `cell` 没有参数输入。 - - **kwargs** ({str: Union[MsDtypes, ParamTypes]}) - 键的类型必须是str,值必须是MsDtypes或类型必须是ParamTypes。用来说明带有关键字的形参的输入参数名称。输入名称在源代码中作为语句表达式中的 `kwargs`。默认为None,表示没有 `kwargs` 输入。 + - **kwargs** (dict{str,Union[MsDtypes, ParamTypes]}) - 键的类型必须是str,值必须是MsDtypes或类型必须是ParamTypes。用来说明带有关键字的形参的输入参数名称。输入名称在源代码中作为语句表达式中的 `kwargs`。默认为None,表示没有 `kwargs` 输入。 返回: 一个Node实例。 diff --git a/mindspore/python/mindspore/dataset/engine/datasets_vision.py b/mindspore/python/mindspore/dataset/engine/datasets_vision.py index 48a181da399..110a915cd32 100644 --- a/mindspore/python/mindspore/dataset/engine/datasets_vision.py +++ b/mindspore/python/mindspore/dataset/engine/datasets_vision.py @@ -3794,7 +3794,7 @@ class SBDataset(GeneratorDataset): - The tensor of column :py:obj:`image` is of the uint8 type. - The tensor of column :py:obj:`task` contains 20 images of the uint8 type if `task` is 'Boundaries' otherwise - contains 1 image of the uint8 type. + contains 1 image of the uint8 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 9ef47a2017c..d64beb08f90 100644 --- a/mindspore/python/mindspore/nn/layer/pooling.py +++ b/mindspore/python/mindspore/nn/layer/pooling.py @@ -112,8 +112,8 @@ class MaxPool3d(Cell): Inputs: - **x** (Tensor) - Tensor of shape :math:`(N_{in}, C_{in}, D_{in}, H_{in}, W_{in})` or - :math:`(C_{in}, D_{in}, H_{in}, W_{in})` with data type of int8, int16, int32, - int64, uint8, uint16, uint32, uint64, float16, float32 or float64. + :math:`(C_{in}, D_{in}, H_{in}, W_{in})` with data type of int8, int16, int32, + int64, uint8, uint16, uint32, uint64, float16, float32 or float64. Outputs: If `return_indices` is False, output is a Tensor, with shape :math:`(N, C, D_{out}, H_{out}, W_{out})`, or diff --git a/mindspore/python/mindspore/nn/loss/loss.py b/mindspore/python/mindspore/nn/loss/loss.py index 071b515b2fc..69ccc84c737 100644 --- a/mindspore/python/mindspore/nn/loss/loss.py +++ b/mindspore/python/mindspore/nn/loss/loss.py @@ -2263,7 +2263,7 @@ class GaussianNLLLoss(LossBase): full (bool): Include the constant term in the loss calculation. When :math:`full=True`, the constant term `const.` will be :math:`0.5 * log(2\pi)`. Default: False. eps (float): Used to improve the stability of log function. Default: 1e-6. - reduction (string): Apply specific reduction method to the output: 'none', 'mean', or 'sum'. Default: 'mean'. + reduction (str): Apply specific reduction method to the output: 'none', 'mean', or 'sum'. Default: 'mean'. Inputs: - **logits** (Tensor) - Tensor of shape :math:`(N, *)` or :math:`(*)` where :math:`*` means any number of diff --git a/mindspore/python/mindspore/ops/function/array_func.py b/mindspore/python/mindspore/ops/function/array_func.py index a8ee3edb645..446c72403b2 100644 --- a/mindspore/python/mindspore/ops/function/array_func.py +++ b/mindspore/python/mindspore/ops/function/array_func.py @@ -158,9 +158,9 @@ def reverse(x, axis): The value range of "axis" is [-dims, dims - 1]. "dims" is the dimension length of "input_x". Args: - - **x** (Tensor) - The target tensor. The data type is Number except float64. - The shape is :math:`(N,*)` where :math:`*` means, any number of additional dimensions. - - **axis** (Union[tuple(int), list(int)]): The indices of the dimensions to reverse. + x (Tensor): The target tensor. The data type is Number except float64. + The shape is :math:`(N,*)` where :math:`*` means, any number of additional dimensions. + axis (Union[tuple(int), list(int)]): The indices of the dimensions to reverse. Outputs: Tensor, has the same shape and type as `x`. diff --git a/mindspore/python/mindspore/profiler/profiling.py b/mindspore/python/mindspore/profiler/profiling.py index 2f3a1438180..1dae605a5a4 100644 --- a/mindspore/python/mindspore/profiler/profiling.py +++ b/mindspore/python/mindspore/profiler/profiling.py @@ -58,7 +58,7 @@ def _environment_check(): class Profiler: - """ + r""" This class to enable the profiling of MindSpore neural networks. MindSpore users can import the mindspore.Profiler, initialize the Profiler object to start profiling, and use Profiler.analyse() to stop profiling and analyse the results. @@ -85,7 +85,7 @@ class Profiler: - 2: Memory contains ub_read/write_bw, l1_read/write_bw, l2_read/write_bw, main_mem_read/write_bw etc. - 3: MemoryL0 contains l0a_read/write_bw, l0b_read/write_bw, l0c_read/write_bw etc. - 4: ResourceConflictRatio contains vec_bankgroup/bank/resc_cflt_ratio etc. - - 5: MemoryUB contains ub_read/write_bw_mte, ub_read/write_bw_vector, ub_/write_bw_scalar etc. + - 5: MemoryUB contains ub_read/write_bw_mte, ub_read/write_bw_vector, ub\_/write_bw_scalar etc. l2_cache (bool, optional): (Ascend only) Whether to collect l2 cache data, collect when True. Default: False. diff --git a/mindspore/python/mindspore/rewrite/api/symbol_tree.py b/mindspore/python/mindspore/rewrite/api/symbol_tree.py index df03d78b332..c437aac2507 100644 --- a/mindspore/python/mindspore/rewrite/api/symbol_tree.py +++ b/mindspore/python/mindspore/rewrite/api/symbol_tree.py @@ -75,17 +75,18 @@ class SymbolTree: raise TypeError(f"For call-function Node, got unsupported kwarg value: {v}, type: {type(v)}") def create_call_function(self, func, targets, *args, **kwargs): - """ + r""" Create a Node object and generate the execution code to insert into the source code. The source code calls the 'func' function with 'args' and' kwargs' as parameters. Args: - func (FunctionType) - The function to be called. - targets (list [str]) - indicates the output name. As the output of the node in the source code. - args (Union[MsDtypes, ParamTypes]) - parameter name of the node. Used as a parameter to a code statement in + func (FunctionType): The function to be called. + targets (list[str]): indicates the output name. As the output of the node in the source code. + args (Union[MsDtypes, ParamTypes]): parameter name of the node. Used as a parameter to a code statement in source code. The default value is None, which means there is no parameter input in the cell. - kwargs ({str: Union[MsDtypes, ParamTypes]}) - The key type must be str, and the value must be value or type - must be ParamTypes. The input parameter name used to describe the formal parameter with a keyword. + kwargs (dict{str,Union[MsDtypes, ParamTypes]}): The key type must be str, + and the value must be value or type must be ParamTypes. + The input parameter name used to describe the formal parameter with a keyword. Enter the name in the source code as the 'kwargs' in the statement expression.The default value is None, which means there is no 'kwargs' input.