forked from mindspore-Ecosystem/mindspore
!30400 modify error format for chinese python api.
Merge pull request !30400 from zhangyi/code_docs_master
This commit is contained in:
commit
f38bbc898f
|
@ -1,7 +1,7 @@
|
|||
mindspore.dataset.audio.utils.ScaleType
|
||||
=================================================
|
||||
|
||||
.. py:class:: mindspore.dataset.audio.utils.ScaleType(value, names=None, *, module=None, qualname=None, type=None, start=1)
|
||||
.. py:class:: mindspore.dataset.audio.utils.ScaleType
|
||||
|
||||
音频标度枚举类。
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
此模块用于文本数据增强,包括 `transforms` 和 `utils` 两个子模块。
|
||||
`transforms` 是一个高性能文本数据增强模块,支持常见的文本数据增强处理。
|
||||
`utils` 提供了一些文本处理的工具方法。
|
|
@ -1,3 +0,0 @@
|
|||
此模块用于通用数据增强,包括 `c_transforms` 和 `py_transforms` 两个子模块。
|
||||
`c_transforms` 是一个高性能数据增强模块,基于C++实现。
|
||||
而 `py_transforms` 提供了一种基于Python和NumPy的实现方式。
|
|
@ -1,7 +1,7 @@
|
|||
mindspore.dataset.vision.SliceMode
|
||||
==================================
|
||||
|
||||
.. py:class:: mindspore.dataset.vision.SliceMode()
|
||||
.. py:class:: mindspore.dataset.vision.SliceMode
|
||||
|
||||
Tensor切片方式枚举类。
|
||||
|
||||
|
|
|
@ -16,4 +16,4 @@ mindspore.dataset.vision.c_transforms.RandomResizedCropWithBBox
|
|||
- Inter.NEAREST,最近邻插值。
|
||||
- Inter.BICUBIC,双三次插值。
|
||||
|
||||
- **max_attempts** (int, optional): 生成随机裁剪位置的最大尝试次数,超过该次数时将使用中心裁剪,默认值:10。
|
||||
- **max_attempts** (int, optional): 生成随机裁剪位置的最大尝试次数,超过该次数时将使用中心裁剪,默认值:10。
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
**参数:**
|
||||
|
||||
- **fields** (list[str],可选) - 索引字段的列表,例如['fine_label', 'coarse_label']。默认值:None。
|
||||
索引字段的设置请参考函数 :func: `mindspore.mindrecord.FileWriter.add_index` 。
|
||||
索引字段的设置请参考函数 :func:`mindspore.mindrecord.FileWriter.add_index` 。
|
||||
|
||||
**返回:**
|
||||
|
||||
|
@ -32,12 +32,12 @@
|
|||
|
||||
.. py:method:: transform(fields=None)
|
||||
|
||||
:func: `mindspore.mindrecord.Cifar100ToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
:func:`mindspore.mindrecord.Cifar100ToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
|
||||
**参数:**
|
||||
|
||||
- **fields** (list[str],可选) - 索引字段的列表,例如['fine_label', 'coarse_label']。默认值:None。
|
||||
索引字段的设置请参考函数 :func: `mindspore.mindrecord.FileWriter.add_index` 。
|
||||
索引字段的设置请参考函数 :func:`mindspore.mindrecord.FileWriter.add_index` 。
|
||||
|
||||
**返回:**
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
**参数:**
|
||||
|
||||
- **fields** (list[str],可选) - 索引字段的列表。默认值:None。
|
||||
索引字段的设置请参考函数 :func: `mindspore.mindrecord.FileWriter.add_index` 。
|
||||
索引字段的设置请参考函数 :func:`mindspore.mindrecord.FileWriter.add_index` 。
|
||||
|
||||
**返回:**
|
||||
|
||||
|
@ -32,12 +32,12 @@
|
|||
|
||||
.. py:method:: transform(fields=None)
|
||||
|
||||
:func: `mindspore.mindrecord.Cifar10ToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
:func:`mindspore.mindrecord.Cifar10ToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
|
||||
**参数:**
|
||||
|
||||
- **fields** (list[str],可选) - 索引字段的列表。默认值:None。
|
||||
索引字段的设置请参考函数 :func: `mindspore.mindrecord.FileWriter.add_index` 。
|
||||
索引字段的设置请参考函数 :func:`mindspore.mindrecord.FileWriter.add_index` 。
|
||||
|
||||
**返回:**
|
||||
|
||||
|
|
|
@ -30,4 +30,4 @@
|
|||
|
||||
.. py:method:: transform()
|
||||
|
||||
:func: `mindspore.mindrecord.CsvToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
:func:`mindspore.mindrecord.CsvToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
|
|
|
@ -36,4 +36,4 @@
|
|||
|
||||
.. py:method:: transform()
|
||||
|
||||
:func: `mindspore.mindrecord.ImageNetToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
:func:`mindspore.mindrecord.ImageNetToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
|
|
|
@ -25,4 +25,4 @@
|
|||
|
||||
.. py:method:: transform()
|
||||
|
||||
:func: `mindspore.mindrecord.MnistToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
:func:`mindspore.mindrecord.MnistToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
|
|
|
@ -48,4 +48,4 @@
|
|||
|
||||
.. py:method:: transform()
|
||||
|
||||
:func: `mindspore.mindrecord.TFRecordToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
:func:`mindspore.mindrecord.TFRecordToMR.run` 函数的包装函数来保证异常时正常退出。
|
||||
|
|
|
@ -235,7 +235,7 @@ Boost能够自动加速网络,如减少BN/梯度冻结/累积梯度等。
|
|||
- **network** (Cell) – 训练网络。
|
||||
- **optimizer** (Union[Cell]) – 用于更新权重的优化器。
|
||||
|
||||
.. py:method:: freeze_cell(reducer_flag, network, optimizer, sens, grad, use_grad_accumulation, mean=None, degree=None, max_accumulation_step=1)
|
||||
.. py:function:: freeze_cell(reducer_flag, network, optimizer, sens, grad, use_grad_accumulation, mean=None, degree=None, max_accumulation_step=1)
|
||||
|
||||
提供带梯度冻结的网络Cell。
|
||||
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
mindspore.dataset.text
|
||||
======================
|
||||
|
||||
This module is to support text processing for NLP. It includes two parts: transforms and utils. transforms is a high performance NLP text processing module which is developed with ICU4C and cppjieba. utils provides some general methods for NLP text processing.
|
||||
此模块用于文本数据增强,包括 `transforms` 和 `utils` 两个子模块。
|
||||
|
||||
Common imported modules in corresponding API examples are as follows:
|
||||
`transforms` 是一个高性能文本数据增强模块,支持常见的文本数据增强处理。
|
||||
|
||||
`utils` 提供了一些文本处理的工具方法。
|
||||
|
||||
|
||||
在API示例中,常用的模块导入方法如下:
|
||||
|
||||
.. code-block::
|
||||
|
||||
|
@ -13,7 +18,7 @@ Common imported modules in corresponding API examples are as follows:
|
|||
mindspore.dataset.text.transforms
|
||||
---------------------------------
|
||||
|
||||
.. msnoteautosummary::
|
||||
.. mscnnoteautosummary::
|
||||
:toctree: dataset_text
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
@ -41,7 +46,7 @@ mindspore.dataset.text.transforms
|
|||
mindspore.dataset.text.utils
|
||||
----------------------------
|
||||
|
||||
.. msnoteautosummary::
|
||||
.. mscnnoteautosummary::
|
||||
:toctree: dataset_text
|
||||
:nosignatures:
|
||||
:template: classtemplate.rst
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
mindspore.dataset.transforms
|
||||
============================
|
||||
|
||||
This module is to support common augmentations. C_transforms is a high performance image augmentation module which is developed with C++ OpenCV. Py_transforms provide more kinds of image augmentations which are developed with Python PIL.
|
||||
此模块用于通用数据增强,包括 `c_transforms` 和 `py_transforms` 两个子模块。
|
||||
|
||||
Common imported modules in corresponding API examples are as follows:
|
||||
`c_transforms` 是一个高性能数据增强模块,基于C++实现。
|
||||
|
||||
而 `py_transforms` 提供了一种基于Python和NumPy的实现方式。
|
||||
|
||||
在API示例中,常用的模块导入方法如下:
|
||||
|
||||
.. code-block::
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
mindspore.nn.probability
|
||||
============================
|
||||
|
||||
.. py:class:: mindspore.nn.probability
|
||||
|
||||
用于构造概率网络的高级组件。
|
||||
用于构造概率网络的高级组件。
|
||||
|
||||
Bijectors
|
||||
---------
|
||||
|
|
|
@ -2,7 +2,7 @@ mindspore.nn.transformer
|
|||
========================
|
||||
|
||||
.. note::
|
||||
Transformer Networks. This is an experimental interface that is subject to change or deletion.
|
||||
Transformer网络。这些是实验性接口,可能会修改或删除。
|
||||
|
||||
.. include:: transformer/mindspore.nn.AttentionMask.rst
|
||||
.. include:: transformer/mindspore.nn.VocabEmbedding.rst
|
||||
|
|
|
@ -23,7 +23,7 @@ Numpy-like interfaces in mindspore.
|
|||
Array Generation
|
||||
----------------
|
||||
|
||||
.. mscnplatformautosummary::
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
@ -74,7 +74,7 @@ Array Generation
|
|||
Array Operation
|
||||
---------------
|
||||
|
||||
.. mscnplatformautosummary::
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
@ -127,7 +127,7 @@ Array Operation
|
|||
Logic
|
||||
-----
|
||||
|
||||
.. mscnplatformautosummary::
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
@ -159,7 +159,7 @@ Logic
|
|||
Math
|
||||
----
|
||||
|
||||
.. mscnplatformautosummary::
|
||||
.. msplatformautosummary::
|
||||
:toctree: numpy
|
||||
:nosignatures:
|
||||
:template: classtemplate_inherited.rst
|
||||
|
|
|
@ -52,9 +52,9 @@
|
|||
- **fully_use_devices** (bool) - 表示是否仅搜索充分利用所有可用设备的策略。默认值:True。例如,如果有8个可用设备,当该参数设为true时,策略(4, 1)将不包括在ReLU的候选策略中,因为策略(4, 1)仅使用4个设备。
|
||||
- **elementwise_op_strategy_follow** (bool) - 表示elementwise算子是否具有与后续算子一样的策略。默认值:False例如,Add跟随的ReLU,其中ReLU是elementwise算子。如果该参数设置为true,则算法搜索的策略可以保证这两个算子的策略是一致的,例如,ReLU的策略(8, 1)和Add的策略((8, 1), (8, 1))。
|
||||
- **enable_algo_approxi** (bool) - 表示是否在算法中启用近似。默认值:False。由于大型DNN模型的并行搜索策略有较大的解空间,该算法在这种情况下耗时较长。为了缓解这种情况,如果该参数设置为true,则会进行近似丢弃一些候选策略,以便缩小解空间。
|
||||
- **algo_approxi_epsilon** (float) - 表示近似算法中使用的epsilon值。默认值:0.1 此值描述了近似程度。例如,一个算子的候选策略数量为S,如果`enable_algo_approxi'为true,则剩余策略的大小为min{S, 1/epsilon}。
|
||||
- **algo_approxi_epsilon** (float) - 表示近似算法中使用的epsilon值。默认值:0.1 此值描述了近似程度。例如,一个算子的候选策略数量为S,如果 `enable_algo_approxi` 为true,则剩余策略的大小为min{S, 1/epsilon}。
|
||||
- **tensor_slice_align_enable** (bool) - 表示是否检查MatMul的tensor切片的shape。默认值:False 受某些硬件的属性限制,只有shape较大的MatMul内核才能显示出优势。如果该参数为true,则检查MatMul的切片shape以阻断不规则的shape。
|
||||
- **tensor_slice_align_size** (int) - 表示MatMul的最小tensor切片的shape,该值必须在[1,1024]范围内。默认值:16。 如果`tensor_slice_align_enable'设为true,则MatMul tensor的最后维度的切片大小应该是该值的倍数。
|
||||
- **tensor_slice_align_size** (int) - 表示MatMul的最小tensor切片的shape,该值必须在[1,1024]范围内。默认值:16。 如果 `tensor_slice_align_enable` 设为true,则MatMul tensor的最后维度的切片大小应该是该值的倍数。
|
||||
|
||||
**异常:**
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ mindspore.train.callback
|
|||
.. include:: train/mindspore.train.callback.SummaryLandscape.rst
|
||||
|
||||
.. automodule:: mindspore.train.callback
|
||||
:exclude-members: FederatedLearningManager
|
||||
:members:
|
||||
|
||||
mindspore.train.train_thor
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
- **softmax_compute_type** (dtype.Number) - 表示softmax计算模块的类型。默认值:dtype.float32。 其值应为dtype.float32或dtype.float16。
|
||||
- **use_past** (bool) - 使用过去状态进行计算,用于增量预测。例如,如果我们有两个单词,想生成十个或以上单词。我们只需要计算一次这两个单词的状态,然后逐个生成下一个单词。当use_past为True时,有两个步骤可以执行预测。
|
||||
第一步是通过 `model.add_flags_recursive(is_first_iteration=True)` 将is_first_iteration设为True,并传递完整的输入。然后,通过 `model.add_flags_recursive(is_first_iteration=False)` 将is_first_iteration设为False。此时,传递step的输入tensor,并对其进行循环。默认值:False
|
||||
- **parallel_config** (OpParallelConfig) - 表示并行配置。默认值为`default_dpmp_config`,表示一个带有参数的`OpParallelConfig`实例。
|
||||
- **parallel_config** (OpParallelConfig) - 表示并行配置。默认值为 `default_dpmp_config` ,表示一个带有参数的 `OpParallelConfig` 实例。
|
||||
|
||||
**输入:**
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. py:class:: mindspore.nn.transformer.Transformer(hidden_size, batch_size, ffn_hidden_size, src_seq_length, tgt_seq_length, encoder_layers=3, decoder_layers=3, num_heads=2, attention_dropout_rate=0.1, hidden_dropout_rate=0.1, hidden_act="gelu", post_layernorm_residual=False, layernorm_compute_type=mstype.float32, softmax_compute_type=mstype.float32, param_init_type=mstype.float32, lambda_func=None, use_past=False, moe_config=default_moe_config, parallel_config=default_transformer_config)
|
||||
|
||||
Transformer模块,包括编码器和解码器。与原始的实现方式的区别在于该模块在实行层归一化之前使用了残差加法。默认的激活层为`gelu`。
|
||||
Transformer模块,包括编码器和解码器。与原始的实现方式的区别在于该模块在实行层归一化之前使用了残差加法。默认的激活层为 `gelu` 。
|
||||
详细信息可参考 `Attention Is All You Need <https://arxiv.org/pdf/1706.03762v5.pdf>`_ 。
|
||||
|
||||
.. note::
|
||||
|
@ -9,8 +9,8 @@
|
|||
**参数:**
|
||||
|
||||
- **batch_size** (int) - 表示输入的批次大小。
|
||||
- **encoder_layers** (int) - 表示`TransformerEncoderLayer`的层数。
|
||||
- **decoder_layers** (int) - 表示`TransformerDecoderLayer`的层数。
|
||||
- **encoder_layers** (int) - 表示 `TransformerEncoderLayer` 的层数。
|
||||
- **decoder_layers** (int) - 表示 `TransformerDecoderLayer` 的层数。
|
||||
- **hidden_size** (int) - 表示输入向量的大小。
|
||||
- **ffn_hidden_size** (int) - 表示前馈层中bottleneck的隐藏大小。
|
||||
- **src_seq_length** (int) - 表示编码器的输入Tensor的seq_length。
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
- **layernorm_compute_type** (dtype.Number) - 表示LayerNorm的计算类型。其值应为dtype.float32或dtype.float16。默认值为dtype.float32。
|
||||
- **softmax_compute_type** (dtype.Number) - 表示注意力中softmax的计算类型。其值应为dtype.float32或dtype.float16。默认值为mstype.float32。
|
||||
- **param_init_type** (dtype.Number) - 表示模块的参数初始化类型。其值应为dtype.float32或dtype.float16。默认值为dtype.float32。
|
||||
- **offset** (int) - 表示`decoder`的初始层索引偏移值。其用于设置梯度聚合的融合值和流水线并行的stage值,使其不与编码器层的相关属性重叠。
|
||||
- **offset** (int) - 表示 `decoder` 的初始层索引偏移值。其用于设置梯度聚合的融合值和流水线并行的stage值,使其不与编码器层的相关属性重叠。
|
||||
- **lambda_func** - 表示确定梯度融合索引、pipeline阶段和重计算属性的函数。如果用户想确定pipeline阶段和梯度聚合融合,用户可以传递一个接受 `network` 、 `layer_id` 、 `offset` 、 `parallel_config` 和 `layers` 的函数。 `network(Cell)` 表示transformer块, `layer_id(int)` 表示当前模块的层索引,从零开始计数, `offset(int)` 表示如果网络中还有其他模块,则layer_index需要一个偏置。pipeline的默认设置为: `(layer_id + offset) // (layers / pipeline_stage)` 。默认值:None
|
||||
- **moe_config** (MoEConfig) - 表示MoE (Mixture of Expert)的配置。
|
||||
- **parallel_config** (TransformerOpParallelConfig) - 表示并行配置。默认值为 `default_transformer_config` ,表示带有默认参数的 `TransformerOpParallelConfig` 实例。
|
||||
|
|
Loading…
Reference in New Issue