diff --git a/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToPIL.rst b/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToPIL.rst index 558561de311..d339de5bd96 100644 --- a/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToPIL.rst +++ b/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToPIL.rst @@ -5,7 +5,7 @@ mindspore.dataset.vision.ToPIL 将已解码的numpy.ndarray图像转换为PIL图像。 - .. note:: 转换模式将根据 :class:`PIL.Image.fromarray` 由图像的数据类型决定。 + .. note:: 转换模式将根据 `PIL.Image.fromarray` 由图像的数据类型决定。 异常: - - **TypeError** - 当输入图像的类型不为 :class:`numpy.ndarray` 或 :class:`PIL.Image.Image` 。 + - **TypeError** - 当输入图像的类型不为 :class:`numpy.ndarray` 或 `PIL.Image.Image` 。 diff --git a/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToTensor.rst b/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToTensor.rst index 55473553966..1533c4318f4 100644 --- a/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToTensor.rst +++ b/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToTensor.rst @@ -6,8 +6,8 @@ mindspore.dataset.vision.ToTensor 将输入PIL图像或numpy.ndarray图像转换为指定类型的numpy.ndarray图像,图像的像素值范围将从[0, 255]放缩为[0.0, 1.0],shape将从(H, W, C)调整为(C, H, W)。 参数: - - **output_type** (Union[mindspore.dtype, numpy.dtype],可选) - 输出图像的数据类型。默认值::class:`numpy.float32` 。 + - **output_type** (Union[mindspore.dtype, numpy.dtype],可选) - 输出图像的数据类型。默认值:`numpy.float32` 。 异常: - - **TypeError** - 当输入图像的类型不为 :class:`PIL.Image.Image` 或 :class:`numpy.ndarray` 。 + - **TypeError** - 当输入图像的类型不为 `PIL.Image.Image` 或 :class:`numpy.ndarray` 。 - **TypeError** - 输入图像的维度不为2或3。 diff --git a/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToType.rst b/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToType.rst index c75e2abd1ba..630503474d2 100644 --- a/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToType.rst +++ b/docs/api/api_python/dataset_vision/mindspore.dataset.vision.ToType.rst @@ -10,7 +10,7 @@ mindspore.dataset.vision.ToType .. note:: 此操作支持通过 Offload 在 Ascend 或 GPU 平台上运行。 参数: - - **data_type** (Union[mindspore.dtype, numpy.dtype]) - 输出图像的数据类型,例如 :class:`numpy.float32` 。 + - **data_type** (Union[mindspore.dtype, numpy.dtype]) - 输出图像的数据类型,例如 `numpy.float32` 。 异常: - **TypeError** - 当 `data_type` 的类型不为 :class:`mindspore.dtype` 或 :class:`numpy.dtype` 。 diff --git a/docs/api/api_python/ops/mindspore.ops.NPUClearFloatStatus.rst b/docs/api/api_python/ops/mindspore.ops.NPUClearFloatStatus.rst index 3872b75be59..b4b7cbec128 100644 --- a/docs/api/api_python/ops/mindspore.ops.NPUClearFloatStatus.rst +++ b/docs/api/api_python/ops/mindspore.ops.NPUClearFloatStatus.rst @@ -6,12 +6,12 @@ mindspore.ops.NPUClearFloatStatus 清除存储溢出状态的标识。 .. note:: - 该标志位于 `Acend` 设备上的寄存器中。在调用 :class:`NPUClearFloatStatus` 后,它将被重置,不能再次重用。此外,使用有严格的使用顺序要求,即在使用 :class:`NPUGetFloatStatus` 算子之前,需要确保 :class:`NPUClearFloatStatus` 和需执行的计算已执行。我们使用 :class:`mindspore.ops.Depend` 确保执行顺序。 + 该标志位于 `Acend` 设备上的寄存器中。在调用 `NPUClearFloatStatus` 后,它将被重置,不能再次重用。此外,使用有严格的使用顺序要求,即在使用 :class:`mindspore.ops.NPUGetFloatStatus` 算子之前,需要确保 `NPUClearFloatStatus` 和需执行的计算已执行。我们使用 :class:`mindspore.ops.Depend` 确保执行顺序。 请参考 :class:`mindspore.ops.NPUGetFloatStatus` 的样例。 输入: - - **x** (Tensor) - :class:`NPUAllocFloatStatus` 的输出Tensor。数据类型必须为float16或float32。 + - **x** (Tensor) - :class:`mindspore.ops.NPUAllocFloatStatus` 的输出Tensor。数据类型必须为float16或float32。 输出: Tensor,shape与 `x` 相同。Tensor中的所有元素都将为零。 diff --git a/docs/api/api_python/ops/mindspore.ops.NPUGetFloatStatus.rst b/docs/api/api_python/ops/mindspore.ops.NPUGetFloatStatus.rst index dd42fbe6724..9e5ac551efc 100644 --- a/docs/api/api_python/ops/mindspore.ops.NPUGetFloatStatus.rst +++ b/docs/api/api_python/ops/mindspore.ops.NPUGetFloatStatus.rst @@ -3,13 +3,13 @@ mindspore.ops.NPUGetFloatStatus .. py:class:: mindspore.ops.NPUGetFloatStatus - 在执行 :class:`mindspore.ops.NPUAllocFloatStatus` 后, :class:`mindspore.ops.NPUGetFloatStatus` 获取最新溢出状态并更新标识。 + 在执行 :class:`mindspore.ops.NPUAllocFloatStatus` 后, `NPUGetFloatStatus` 获取最新溢出状态并更新标识。 .. note:: - 标志是一个Tensor,其shape为 :math:`(8,)` ,数据类型为 `mindspore.dtype.float32` 。如果标志的和等于0,则没有发生溢出。如果标志之和大于0,则发生溢出。此外,使用有严格的顺序要求,即在使用 :class:`NPUGetFloatStatus` 算子之前,需要确保 :class:`NPUClearFloatStatus` 和需执行的计算已执行。使用 :class:`mindspore.ops.Depend` 确保执行顺序。 + 标志是一个Tensor,其shape为 :math:`(8,)` ,数据类型为 `mindspore.dtype.float32` 。如果标志的和等于0,则没有发生溢出。如果标志之和大于0,则发生溢出。此外,使用有严格的顺序要求,即在使用 `NPUGetFloatStatus` 算子之前,需要确保 :class:`mindspore.ops.NPUClearFloatStatus` 和需执行的计算已执行。使用 :class:`mindspore.ops.Depend` 确保执行顺序。 输入: - - **x** (Tensor) - :class:`NPUAllocFloatStatus` 的输出Tensor。数据类型必须为float16或float32。 :math:`(N,*)` ,其中 :math:`*` 表示任意附加维度,其rank应小于8。 + - **x** (Tensor) - :class:`mindspore.ops.NPUAllocFloatStatus` 的输出Tensor。数据类型必须为float16或float32。 :math:`(N,*)` ,其中 :math:`*` 表示任意附加维度,其rank应小于8。 输出: Tensor,shape与 `x` 相同。Tensor中的所有元素都将为零。 diff --git a/docs/api/api_python/ops/mindspore.ops.func_choice_with_mask.rst b/docs/api/api_python/ops/mindspore.ops.func_choice_with_mask.rst index 511aa592494..4fccd97216c 100644 --- a/docs/api/api_python/ops/mindspore.ops.func_choice_with_mask.rst +++ b/docs/api/api_python/ops/mindspore.ops.func_choice_with_mask.rst @@ -11,7 +11,7 @@ mindspore.ops.choice_with_mask 参数: - **input_x** (Tensor[bool]) - 输入Tensor,bool类型。秩必须大于等于1且小于等于5。 - **count** (int) - 取样数量,必须大于0。默认值:256。 - - **seed** (int) - 随机种子。默认值:None。 + - **seed** (int,可选) - 随机种子。默认值:None。 返回: 两个Tensor,第一个为索引,另一个为掩码。 diff --git a/docs/api/api_python/transformer/mindspore.nn.transformer.FixedSparseAttention.rst b/docs/api/api_python/transformer/mindspore.nn.transformer.FixedSparseAttention.rst index 7500c11d114..d409e3b2734 100644 --- a/docs/api/api_python/transformer/mindspore.nn.transformer.FixedSparseAttention.rst +++ b/docs/api/api_python/transformer/mindspore.nn.transformer.FixedSparseAttention.rst @@ -20,10 +20,10 @@ - **parallel_config** (OpParallelConfig) - 并行设置,内容请参阅 `OpParallelConfig` 的定义。默认值为 `default_dpmp_config` ,一个用默认参数初始化的 `OpParallelConfig` 的实例。 输入: - - **q** (Tensor) - Tensor query (:class:`mstype.fp16` [batch_size, seq_length, hidden_size]):表示上下文的query向量。 - - **k** (Tensor) - Tensor key (:class:`mstype.fp16` [batch_size, seq_length, hidden_size]):表示上下文的key向量。 - - **v** (Tensor) - Tensor value (:class:`mstype.fp16` [批次大小, seq_length, hidden_size]):表示上下文的value向量。 - - **attention_mask** (Tensor) - Float Tensor the mask of (:class:`mstype.fp32` , :class:`mstype.fp16` [batch_size, seq_length, seq_length]): + - **q** (Tensor) - Tensor query ( `mstype.fp16` [batch_size, seq_length, hidden_size]):表示上下文的query向量。 + - **k** (Tensor) - Tensor key ( `mstype.fp16` [batch_size, seq_length, hidden_size]):表示上下文的key向量。 + - **v** (Tensor) - Tensor value ( `mstype.fp16` [批次大小, seq_length, hidden_size]):表示上下文的value向量。 + - **attention_mask** (Tensor) - Float Tensor the mask of ( `mstype.fp32` , `mstype.fp16` [batch_size, seq_length, seq_length]): 表示掩码的下三角形矩阵。 输出: diff --git a/mindspore/python/mindspore/common/tensor.py b/mindspore/python/mindspore/common/tensor.py index 9cdf2e6f9cb..34e2a89759f 100644 --- a/mindspore/python/mindspore/common/tensor.py +++ b/mindspore/python/mindspore/common/tensor.py @@ -2025,7 +2025,7 @@ class Tensor(Tensor_): Args: dtype (Union[:class:`mindspore.dtype`, numpy.dtype, str]): Designated tensor dtype, can be in - format of :class:`mindspore.dtype.float32` or :class:`numpy.float32` or `float32`. + format of `mindspore.dtype.float32` or `numpy.float32` or `float32`. copy (bool, optional): By default, astype always returns a newly allocated tensor. If this is set to false, the input tensor is returned instead of a copy. Default: True. diff --git a/mindspore/python/mindspore/dataset/transforms/transforms.py b/mindspore/python/mindspore/dataset/transforms/transforms.py index a3d6c4fc725..f0d53ad5743 100644 --- a/mindspore/python/mindspore/dataset/transforms/transforms.py +++ b/mindspore/python/mindspore/dataset/transforms/transforms.py @@ -889,7 +889,7 @@ class TypeCast(TensorOperation): This operation supports running on Ascend or GPU platforms by Offload. Args: - data_type (Union[mindspore.dtype, numpy.dtype]): mindspore.dtype or numpy.dtype (e.g. :class:`numpy.float32`) + data_type (Union[mindspore.dtype, numpy.dtype]): mindspore.dtype or numpy.dtype (e.g. `numpy.float32`) to be cast to. Raises: diff --git a/mindspore/python/mindspore/dataset/vision/py_transforms.py b/mindspore/python/mindspore/dataset/vision/py_transforms.py index c8d29d92f73..83af012f103 100644 --- a/mindspore/python/mindspore/dataset/vision/py_transforms.py +++ b/mindspore/python/mindspore/dataset/vision/py_transforms.py @@ -1933,10 +1933,10 @@ class ToPIL(py_transforms.PyTensorOperation): Convert the input decoded numpy.ndarray image to PIL Image. Note: - The conversion mode will be determined by the data type using :class:`PIL.Image.fromarray` . + The conversion mode will be determined by the data type using `PIL.Image.fromarray` . Raises: - TypeError: If the input image is not of type :class:`numpy.ndarray` or :class:`PIL.Image.Image` . + TypeError: If the input image is not of type :class:`numpy.ndarray` or `PIL.Image.Image` . Supported Platforms: ``CPU`` @@ -1977,10 +1977,10 @@ class ToTensor(py_transforms.PyTensorOperation): from (H, W, C) to (C, H, W). Args: - output_type (numpy.dtype, optional): The desired dtype of the output image. Default: :class:`numpy.float32` . + output_type (numpy.dtype, optional): The desired dtype of the output image. Default: `numpy.float32` . Raises: - TypeError: If the input image is not of type :class:`PIL.Image.Image` or :class:`numpy.ndarray` . + TypeError: If the input image is not of type `PIL.Image.Image` or :class:`numpy.ndarray` . TypeError: If dimension of the input image is not 2 or 3. Supported Platforms: @@ -2021,7 +2021,7 @@ class ToType(py_transforms.PyTensorOperation): Convert the input numpy.ndarray image to the desired dtype. Args: - output_type (numpy.dtype): The desired dtype of the output image, e.g. :class:`numpy.float32` . + output_type (numpy.dtype): The desired dtype of the output image, e.g. `numpy.float32` . Raises: TypeError: If the input image is not of type :class:`numpy.ndarray` . diff --git a/mindspore/python/mindspore/dataset/vision/transforms.py b/mindspore/python/mindspore/dataset/vision/transforms.py index 97b93577da9..5474e1cf9a5 100644 --- a/mindspore/python/mindspore/dataset/vision/transforms.py +++ b/mindspore/python/mindspore/dataset/vision/transforms.py @@ -4021,10 +4021,10 @@ class ToTensor(ImageTensorOperation): Args: output_type (Union[mindspore.dtype, numpy.dtype], optional): The desired dtype of the output image. - Default: :class:`numpy.float32` . + Default: `numpy.float32` . Raises: - TypeError: If the input image is not of type :class:`PIL.Image.Image` or :class:`numpy.ndarray` . + TypeError: If the input image is not of type `PIL.Image.Image` or :class:`numpy.ndarray` . TypeError: If dimension of the input image is not 2 or 3. Supported Platforms: @@ -4068,7 +4068,7 @@ class ToType(TypeCast): Args: data_type (Union[mindspore.dtype, numpy.dtype]): The desired data type of the output image, - such as :class:`numpy.float32` . + such as `numpy.float32` . Raises: TypeError: If `data_type` is not of type :class:`mindspore.dtype` or :class:`numpy.dtype` . diff --git a/mindspore/python/mindspore/nn/transformer/layers.py b/mindspore/python/mindspore/nn/transformer/layers.py index 3b882702991..69239e581cf 100644 --- a/mindspore/python/mindspore/nn/transformer/layers.py +++ b/mindspore/python/mindspore/nn/transformer/layers.py @@ -593,13 +593,13 @@ class FixedSparseAttention(nn.Cell): default args. Inputs: - - **q** (Tensor) - Tensor query (:class:`mstype.fp16` [batch_size, seq_length, hidden_size]): Sequence of + - **q** (Tensor) - Tensor query ( `mstype.fp16` [batch_size, seq_length, hidden_size]): Sequence of queries to query the context. - - **k** (Tensor) - Tensor key (:class:`mstype.fp16` [batch_size, seq_length, hidden_size]): Sequence of + - **k** (Tensor) - Tensor key ( `mstype.fp16` [batch_size, seq_length, hidden_size]): Sequence of queries to query the context. - - **v** (Tensor) - Tensor value (:class:`mstype.fp16` [batch size, sequence length, Embedding Size]): + - **v** (Tensor) - Tensor value `mstype.fp16` [batch size, sequence length, Embedding Size]): Sequence of queries to query the context. - - **attention_mask** (Tensor) - Float Tensor the mask of (:class:`mstype.fp32`, :class:`mstype.fp16` + - **attention_mask** (Tensor) - Float Tensor the mask of ( `mstype.fp32`, `mstype.fp16` [batch_size, seq_length, seq_length]): Lower triangular matrix to pass masked information. Outputs: diff --git a/mindspore/python/mindspore/ops/operations/math_ops.py b/mindspore/python/mindspore/ops/operations/math_ops.py index 11c5703f605..39deea35aba 100644 --- a/mindspore/python/mindspore/ops/operations/math_ops.py +++ b/mindspore/python/mindspore/ops/operations/math_ops.py @@ -4355,7 +4355,7 @@ class NPUAllocFloatStatus(Primitive): class NPUGetFloatStatus(Primitive): """ - :class:`mindspore.ops.NPUGetFloatStatus` updates the flag which is + `mindspore.ops.NPUGetFloatStatus` updates the flag which is the output tensor of :class:`mindspore.ops.NPUAllocFloatStatus` with the latest overflow status. diff --git a/mindspore/python/mindspore/train/callback/_backup_and_restore.py b/mindspore/python/mindspore/train/callback/_backup_and_restore.py index 903e3ed6b3e..c57fd5233c2 100644 --- a/mindspore/python/mindspore/train/callback/_backup_and_restore.py +++ b/mindspore/python/mindspore/train/callback/_backup_and_restore.py @@ -34,7 +34,7 @@ class BackupAndRestore(Callback): Args: backup_dir (str): Path to store and load the checkpoint file. - save_freq(Union['epoch', int]): When set to `'epoch'` the callback saves the checkpoint at the end of + save_freq(Union['epoch', int]): When set to 'epoch' the callback saves the checkpoint at the end of each epoch. When set to an integer, the callback saves the checkpoint every `save_freq` epoch. Default: 'epoch'. delete_checkpoint(bool): If `delete_checkpoint=True`, the checkpoint will be deleted after