!68971 [Document Consistency] modify format

Merge pull request !68971 from 俞涵/code_docs_mst
This commit is contained in:
i-robot 2024-04-30 08:23:39 +00:00 committed by Gitee
commit ece62d03e3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
13 changed files with 31 additions and 32 deletions

View File

@ -16,5 +16,5 @@ mindspore.Tensor.register_hook
返回:
返回与该hook_fn函数对应的handle对象。可通过调用handle.remove()来删除添加的hook_fn函数。
异常:
- **TypeError** - 如果 `hook_fn` 不是Python函数。
异常:
- **TypeError** - 如果 `hook_fn` 不是Python函数。

View File

@ -3,8 +3,7 @@ mindspore.recompute
.. py:function:: mindspore.recompute(block, *args, **kwargs)
该函数用于减少显存的使用,当运行选定的模块时,不再保存其中的前向计算的产生的激活值,我们将在反向传播时,
重新计算前向的激活值。
该函数用于减少显存的使用,当运行选定的模块时,不再保存其中的前向计算的产生的激活值,我们将在反向传播时,重新计算前向的激活值。
.. note::
- 重计算函数只支持继承自Cell对象的模块

View File

@ -279,11 +279,6 @@
`parameter_layout_dict` 表示一个参数的张量layout这种张量layout是由分片策略和分布式算子信息推断出来的。
.. py:method:: pipeline_stage
:property:
`pipeline_stage` 表示当前Cell所在的stage。
.. py:method:: parameters_and_names(name_prefix='', expand=True)
返回Cell中parameter的迭代器。
@ -320,6 +315,11 @@
返回:
OrderedDict类型返回参数字典。
.. py:method:: pipeline_stage
:property:
`pipeline_stage` 表示当前Cell所在的stage。
.. py:method:: place(role, rank_id)
为该Cell中所有算子设置标签。此标签告诉MindSpore编译器此Cell在哪个进程上启动。

View File

@ -1,5 +1,5 @@
- **float** - <EFBFBD>̶<EFBFBD><EFBFBD><EFBFBD>ѧϰ<EFBFBD>ʡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
- **int** - <EFBFBD>̶<EFBFBD><EFBFBD><EFBFBD>ѧϰ<EFBFBD>ʡ<EFBFBD><EFBFBD><EF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FBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD>Ż<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mindspore.cn/docs/zh-CN/masterateSchedule <https://www.mindspore.cn/docs/zh-CN/r2.3/api_python/mindspore.nn.html#learningrateschedule%E7%B1%BB>`_ ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㵱ǰѧϰ<D1A7>ʡ<EFBFBD>
- **float** - 固定的学习率。必须大于等于零。
- **int** - 固定的学习率。必须大于等于零。整数类型会被转换为浮点数。
- **Tensor** - 可以是标量或一维向量。标量是固定的学习率。一维向量是动态的学习率第i步将取向量中第i个值作为学习率。
- **Iterable** - 动态的学习率。第i步将取迭代器第i个值作为学习率。
- **LearningRateSchedule** - 动态的学习率。在训练过程中优化器将使用步数step作为输入调用 `LearningRateSchedule <https://www.mindspore.cn/docs/zh-CN/master/api_python/mindspore.nn.html#learningrateschedule%E7%B1%BB>`_ 实例来计算当前学习率。

View File

@ -22,7 +22,7 @@ mindspore.ops.layer_norm
- **bias** (Tensor, 可选) - 可学习的偏移值shape为 `normalized_shape` ,默认值: ``None`` 。为 ``None`` 时,初始化为 ``0``
- **eps** (float, 可选) - 添加到分母中的值(:math:`\epsilon`),以确保数值稳定。默认值: ``1e-5``
输出
返回
Tensor归一化后的Tensorshape和数据类型与 `input` 相同。
异常:

View File

@ -16,10 +16,10 @@ batch_mat_mul:
Inputs:
- **x** (Tensor) - The first tensor to be multiplied. The shape of the tensor is :math:`(*B, N, C)`,
where :math:`*B` represents the batch size which can be multidimensional, :math:`N` and :math:`C` are the
size of the last two dimensions. If `transpose_a` is ``True`` , its shape must be :math:`(*B, C, N)`.
where :math:`*B` represents the batch size which can be multidimensional, :math:`N` and :math:`C` are the
size of the last two dimensions. If `transpose_a` is ``True`` , its shape must be :math:`(*B, C, N)`.
- **y** (Tensor) - The second tensor to be multiplied. The shape of the tensor is :math:`(*B, C, M)`. If
`transpose_b` is ``True`` , its shape must be :math:`(*B, M, C)`.
`transpose_b` is ``True`` , its shape must be :math:`(*B, M, C)`.
Outputs:
Tensor, the shape of the output tensor is :math:`(*B, N, M)`.

View File

@ -19,9 +19,9 @@ matmul:
Inputs:
- **a** (Tensor) - The first tensor to be multiplied. The shape of the tensor is :math:`(N, C)`. If
`transpose_a` is ``True`` , its shape must be :math:`(C, N)` after transpose.
`transpose_a` is ``True`` , its shape must be :math:`(C, N)` after transpose.
- **b** (Tensor) - The second tensor to be multiplied. The shape of the tensor is :math:`(C, M)`. If
`transpose_b` is ``True`` , its shape must be :math:`(M, C)` after transpose.
`transpose_b` is ``True`` , its shape must be :math:`(M, C)` after transpose.
Outputs:
Tensor, the shape of the output tensor is :math:`(N, M)`.

View File

@ -9,7 +9,7 @@ ones:
For argument `shape`, Tensor type input will be deprecated in the future version.
Args:
shape (Union[tuple[int], List[int], int, Tensor]): The specified shape of output tensor. Only positive integer or
shape (Union[tuple[int], list[int], int, Tensor]): The specified shape of output tensor. Only positive integer or
tuple or Tensor containing positive integers are allowed. If it is a Tensor,
it must be a 0-D or 1-D Tensor with int32 or int64 dtypes.
dtype (:class:`mindspore.dtype`): The specified type of output tensor. If `dtype` is ``None`` ,

View File

@ -6,7 +6,7 @@ zeros:
For argument `size`, Tensor type input will be deprecated in the future version.
Args:
size (Union[tuple[int], List[int], int, Tensor]): The specified shape of output tensor. Only positive integer or
size (Union[tuple[int], list[int], int, Tensor]): The specified shape of output tensor. Only positive integer or
tuple or Tensor containing positive integers are allowed. If it is a Tensor,
it must be a 0-D or 1-D Tensor with int32 or int64 dtypes.
dtype (:class:`mindspore.dtype`, optional): The specified type of output tensor. If `dtype` is ``None`` ,

View File

@ -38,17 +38,18 @@ def recompute(block, *args, **kwargs):
storing the intermediate activation computed in forward pass, we will recompute it in backward pass.
Note:
- Recompute function only support block which inherited from Cell object.
- This function interface now only support pynative mode. you can use Cell.recompute interface
in graph mode.
- When use recompute function, block object should not decorated by @jit.
- Recompute function only support block which inherited from Cell object.
- This function interface now only support pynative mode. you can use Cell.recompute interface
in graph mode.
- When use recompute function, block object should not decorated by @jit.
Args:
block (Cell): Block to be recompute.
args(tuple): Inputs for block object to run forward pass.
kwargs(dict): Optional input for recompute function.
Returns: Same as return type of block.
Returns:
Same as return type of block.
Raises:
TypeError: If `block` is not Cell object.

View File

@ -4445,7 +4445,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
For argument `size`, Tensor type input will be deprecated in the future version.
Args:
size (Union[int, tuple, list]): An int, list or tuple of integers defining the output shape.
size (Union[int, tuple, list, Tensor]): An int, list or tuple of integers defining the output shape.
dtype (mindspore.dtype, optional): The desired dtype of the output tensor. If None, the returned tensor has
thesame dtype as `self`. Default: ``None``.
@ -4478,7 +4478,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
For argument `size`, Tensor type input will be deprecated in the future version.
Args:
size (Union[int, tuple, list]): An int, list or tuple of integers defining the output shape.
size (Union[int, tuple, list, Tensor]): An int, list or tuple of integers defining the output shape.
dtype (mindspore.dtype, optional): The desired dtype of the output tensor. If None, the returned
tensor has the same dtype as `self`. Default: ``None``.

View File

@ -49,7 +49,7 @@ class Embedding(Cell):
of the index in `input`. Default ``False``.
_weight (Tensor, optional): Used to initialize the weight of Embedding. If ``None``, the weight will be
initialized from normal distribution :math:`{N}(\text{sigma=1.0}, \text{mean=0.0})`. Default ``None``.
dtype (mindspore.dtype) : Dtype of Parameters. It is meaningless when `_weight` is not None.
dtype (mindspore.dtype, optional) : Dtype of Parameters. It is meaningless when `_weight` is not None.
Default: ``mindspore.float32``.
Inputs:
@ -83,7 +83,6 @@ class Embedding(Cell):
[ 0.00233847 -0.00596091 0.00536799]
[-0.0024154 -0.01203444 0.00811537]
[-0.0024154 -0.01203444 0.00811537]]
[[ 0.00233847 -0.00596091 0.00536799]
[ 0.00233847 -0.00596091 0.00536799]
[-0.0024154 -0.01203444 0.00811537]

View File

@ -3646,7 +3646,7 @@ def nanmedian(input, axis=-1, keepdims=False):
.. warning::
`indices` does not necessarily contain the first occurrence of each median value found in the `input`,
unless it is unique.
unless it is unique.
Args:
input (Tensor): The input tensor to calculate the median and indices.