forked from mindspore-Ecosystem/mindspore
optimizes the documentation of chinese API of BatchNorm1d,BatchNorm2d,ClipByNorm,etc.
This commit is contained in:
parent
a3d391ae70
commit
7b04a2c18e
|
@ -17,12 +17,12 @@ mindspore.nn.BatchNorm1d
|
|||
|
||||
**参数:**
|
||||
|
||||
- **num_features** (int) - 指定输入Tensor的通道数量,输入Tensor的size为(N, C)。
|
||||
- **eps** (float) - 加在分母上的值,以确保数值稳定。默认值:1e-5。
|
||||
- **num_features** (int) - 指定输入Tensor的通道数量,输入Tensor的size为 :math:`(N, C)` 。
|
||||
- **eps** (float) - :math:`\epsilon` 加在分母上的值,以确保数值稳定。默认值:1e-5。
|
||||
- **momentum** (float) - 动态均值和动态方差所使用的动量。默认值:0.9。
|
||||
- **affine** (bool) - bool类型。设置为True时,可学习到gama和beta值。默认值:True。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `mindspore.common.initializer` ,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `mindspore.common.initializer` ,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **affine** (bool) - bool类型。设置为True时,可学习到 :math:`\gamma` 和 :math:`\beta` 值。默认值:True。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - :math:`\gamma` 参数的初始化方法。str的值引用自函数 `mindspore.common.initializer` ,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - :math:`\beta` 参数的初始化方法。str的值引用自函数 `mindspore.common.initializer` ,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **moving_mean_init** (Union[Tensor, str, Initializer, numbers.Number]) - 动态平均值的初始化方法。str的值引用自函数 `mindspore.common.initializer` ,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **moving_var_init** (Union[Tensor, str, Initializer, numbers.Number]) - 动态方差的初始化方法。str的值引用自函数 `mindspore.common.initializer` ,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **use_batch_statistics** (bool) - 如果为True,则使用当前批次数据的平均值和方差值。如果为False,则使用指定的平均值和方差值。如果为None,训练时,将使用当前批次数据的均值和方差,并更新动态均值和方差,验证过程将直接使用动态均值和方差。默认值:None。
|
||||
|
|
|
@ -23,15 +23,15 @@ mindspore.nn.BatchNorm2d
|
|||
|
||||
**参数:**
|
||||
|
||||
- **num_features** (int) - 指定输入Tensor的通道数量,输入Tensor的size为(N, C, H, W)。
|
||||
- **eps** (float) - 加在分母上的值,以确保数值稳定。默认值:1e-5。
|
||||
- **num_features** (int) - 指定输入Tensor的通道数量,输入Tensor的size为 :math:`(N, C, H, W)` 。
|
||||
- **eps** (float) - :math:`\epsilon` 加在分母上的值,以确保数值稳定。默认值:1e-5。
|
||||
- **momentum** (float) - 动态均值和动态方差所使用的动量。默认值:0.9。
|
||||
- **affine** (bool) - bool类型。设置为True时,可学习gama和beta值。默认值:True。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `mindspore.common.initializer`,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `mindspore.common.initializer`,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **affine** (bool) - bool类型。设置为True时,可学习 :math:`\gamma` 和 :math:`\beta` 值。默认值:True。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - :math:`\gamma` 参数的初始化方法。str的值引用自函数 `mindspore.common.initializer`,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - :math:`\beta` 参数的初始化方法。str的值引用自函数 `mindspore.common.initializer`,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **moving_mean_init** (Union[Tensor, str, Initializer, numbers.Number]) - 动态平均值的初始化方法。str的值引用自函数 `mindspore.common.initializer`,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **moving_var_init** (Union[Tensor, str, Initializer, numbers.Number]) - 动态方差的初始化方法。str的值引用自函数 `mindspore.common.initializer`,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **use_batch_statistics** (bool) - 如果为True,则使用当前批处理数据的平均值和方差值,并跟踪运行平均值和运行方差。如果为False,则使用指定值的平均值和方差值,不跟踪统计值。如果为None,则根据训练和验证模式自动设置use_batch_statistics为True或False。在训练时,use_batch_statistics会设置为True。在验证时,use_batch_statistics会自动设置为False。默认值:None。
|
||||
- **use_batch_statistics** (bool) - 如果为True,则使用当前批处理数据的平均值和方差值,并跟踪运行平均值和运行方差。如果为False,则使用指定值的平均值和方差值,不跟踪统计值。如果为None,则根据训练和验证模式自动设置 `use_batch_statistics` 为True或False。在训练时, `use_batch_statistics会` 设置为True。在验证时, `use_batch_statistics` 会自动设置为False。默认值:None。
|
||||
- **data_format** (str) - 数据格式可为'NHWC'或'NCHW'。默认值:'NCHW'。
|
||||
|
||||
**输入:**
|
||||
|
|
|
@ -20,7 +20,7 @@ mindspore.nn.ClipByNorm
|
|||
**输入:**
|
||||
|
||||
- **x** (Tensor) - 输入n维的Tensor,数据类型为float32或float16。
|
||||
- **clip_norm** (Tensor) - shape为 :math:`()` 或 :math:`(1)` 的Tensor。或者其shape可以广播到输入的shape。
|
||||
- **clip_norm** (Tensor) - shape为 :math:`()` 或 :math:`(1)` 的Tensor。或者其shape可以广播到 `x` 的shape。
|
||||
|
||||
**输出:**
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ mindspore.nn.Dense
|
|||
- **out_channels** (int) - Dense层输出Tensor的空间维度。
|
||||
- **weight_init** (Union[Tensor, str, Initializer, numbers.Number]) - 权重参数的初始化方法。数据类型与 `x` 相同。str的值引用自函数 `initializer`。默认值:'normal'。
|
||||
- **bias_init** (Union[Tensor, str, Initializer, numbers.Number]) - 偏置参数的初始化方法。数据类型与 `x` 相同。str的值引用自函数 `initializer`。默认值:'zeros'。
|
||||
- **has_bias** (bool) - 是否使用偏置向量。默认值:True。
|
||||
- **has_bias** (bool) - 是否使用偏置向量 :math:`\text{bias}` 。默认值:True。
|
||||
- **activation** (Union[str, Cell, Primitive]) - 应用于全连接层输出的激活函数,例如‘ReLU’。默认值:None。
|
||||
|
||||
**输入:**
|
||||
|
|
|
@ -16,11 +16,11 @@ mindspore.nn.LayerNorm
|
|||
**参数:**
|
||||
|
||||
- **normalized_shape** (Union(tuple[int], list[int]) - 沿轴 `begin_norm_axis ... R - 1` 执行归一化。
|
||||
- **begin_norm_axis** (int) - 归一化开始计算的轴:归一化将在维度 `begin_norm_axis: rank(inputs)` 上执行,取值范围是[-1, rank(input))。默认值:-1。
|
||||
- **begin_params_axis** (int) - 第一个参数(beta, gamma)的维度:scale和centering参数有 `begin_params_axis: rank(inputs)` 个维度,并与输入一起广播,取值范围是[-1, rank(input))。默认值:-1。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gama参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'、'xavier_uniform'、'he_uniform'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'、'xavier_uniform'、'he_uniform'等。默认值:'zeros'。
|
||||
- **epsilon** (float) - 添加到分母中的值,以确保数值稳定。默认值:1e-7。
|
||||
- **begin_norm_axis** (int) - 归一化开始计算的轴,取值范围是[-1, rank(x))。默认值:-1。
|
||||
- **begin_params_axis** (int) - 第一个参数(beta, gamma)的维度:scale和centering参数有 `begin_params_axis: rank(x)` 个维度,并与输入一起广播,取值范围是[-1, rank(input))。默认值:-1。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - :math:`\gamma` 参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'、'xavier_uniform'、'he_uniform'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - :math:`\beta` 参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'、'xavier_uniform'、'he_uniform'等。默认值:'zeros'。
|
||||
- **epsilon** (float) - :math:`\epsilon` 添加到分母中的值,以确保数值稳定。默认值:1e-7。
|
||||
|
||||
**输入:**
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
**参数:**
|
||||
|
||||
- **root_rank** (int) - 表示源秩。除发送数据的进程外,存在于所有进程中。
|
||||
- **root_rank** (int) - 表示发送源的进程编号。除发送数据的进程外,存在于所有进程中。
|
||||
- **group** (str) - 表示通信域。默认值:"hccl_world_group"。
|
||||
|
||||
**输入:**
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
**参数:**
|
||||
|
||||
- **exclusive** (bool) - 如果为True,则执行独占模式。默认值:False。
|
||||
- **exclusive** (bool) - 表示输出结果的第一个元素是否与输入的第一个元素一致。如果为False,表示输出的第一个元素与输入的第一个元素一致。默认值:False。
|
||||
- **reverse** (bool) - 如果为True,则逆向计算累加和。默认值:False。
|
||||
|
||||
**输入:**
|
||||
|
|
|
@ -6,7 +6,7 @@ mindspore.ops.GetNext
|
|||
返回数据集队列中的下一个元素。
|
||||
|
||||
.. note::
|
||||
GetNext操作需要联网,且依赖init_dataset接口,不能单独操作。详见 :class:`mindspore.connect_network_with_dataset` 的源码。
|
||||
GetNext操作需要联网,且依赖'dataset'接口,例如: :class:`mindspore.dataset.MnistDataset` 。不能单独操作。详见 :class:`mindspore.connect_network_with_dataset` 的源码。
|
||||
|
||||
**参数:**
|
||||
|
||||
|
@ -14,6 +14,7 @@ mindspore.ops.GetNext
|
|||
- **shapes** (list[tuple[int]]) - 输出数据的shape大小。
|
||||
- **output_num** (int) - 输出编号、 `types` 和 `shapes` 的长度。
|
||||
- **shared_name** (str) - `init_dataset` 接口名称。
|
||||
- **shared_name** (str) - 待获取数据的队列名称。
|
||||
|
||||
**输入:**
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ mindspore.ops.ScatterAdd
|
|||
|
||||
**参数:**
|
||||
|
||||
- **use_locking** (bool) - 是否启用锁保护。默认值:False。
|
||||
- **use_locking** (bool) - 是否启用锁保护。如果为True,则 `input_x` 将受到锁的保护。否则计算结果是未定义的。默认值:False。
|
||||
|
||||
**输入:**
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ mindspore.ops.batch_dot
|
|||
- **TypeError** - `x1` 或 `x2` 的数据类型不是float32。
|
||||
- **ValueError** - `x1` 或 `x2` 的秩小于2。
|
||||
- **ValueError** - 在轴中使用了代表批量的维度。
|
||||
- **ValueError** - len(axes)小于2。
|
||||
- **ValueError** - `axes` 的长度小于2。
|
||||
- **ValueError** - `axes` 不是其一:None,int,或(int, int)。
|
||||
- **ValueError** - 如果 `axes` 为负值,低于输入数组的维度。
|
||||
- **ValueError** - 如果 `axes` 的值高于输入数组的维度。
|
||||
|
|
|
@ -388,7 +388,7 @@ class ClipByNorm(Cell):
|
|||
Inputs:
|
||||
- **x** (Tensor) - Tensor of shape N-D. The type must be float32 or float16.
|
||||
- **clip_norm** (Tensor) - A scalar Tensor of shape :math:`()` or :math:`(1)`.
|
||||
Or a tensor shape can be broadcast to input shape.
|
||||
Or a tensor shape can be broadcast to input `x` shape.
|
||||
|
||||
Outputs:
|
||||
Tensor, clipped tensor with the same shape as the `x`, whose type is float32.
|
||||
|
|
|
@ -4596,7 +4596,9 @@ class ScatterAdd(_ScatterOpDynamic):
|
|||
This is an in-place update operator. Therefore, the `input_x` will be updated after the operation is completed.
|
||||
|
||||
Args:
|
||||
use_locking (bool): Whether to protect the assignment by a lock. Default: False.
|
||||
use_locking (bool): Whether to protect the assignment by a lock.
|
||||
If true, ` input_x` will be protected by the lock.
|
||||
Otherwise, the calculation result is undefined. Default: False.
|
||||
|
||||
Inputs:
|
||||
- **input_x** (Parameter) - The target tensor, with data type of Parameter.
|
||||
|
|
|
@ -1526,7 +1526,8 @@ class CumSum(PrimitiveWithInfer):
|
|||
y_i = x_1 + x_2 + x_3 + ... + x_i
|
||||
|
||||
Args:
|
||||
exclusive (bool): If true, perform exclusive mode. Default: False.
|
||||
exclusive (bool): By default, this op performs an inclusive cumsum, which means that the first
|
||||
element of the input is identical to the first element of the output. Default: False.
|
||||
reverse (bool): If true, perform inverse cumulative sum. Default: False.
|
||||
|
||||
Inputs:
|
||||
|
|
|
@ -3462,7 +3462,8 @@ class GetNext(Primitive):
|
|||
Returns the next element in the dataset queue.
|
||||
|
||||
Note:
|
||||
The GetNext operation needs to be associated with network and it also depends on the init_dataset interface,
|
||||
The GetNext operation needs to be associated with network and it also depends
|
||||
on the 'dataset' interface, For example, please refer to :class:`mindspore.dataset.MnistDataset` .
|
||||
it can't be used directly as a single operation.
|
||||
For details, please refer to :class:`mindspore.connect_network_with_dataset` source code.
|
||||
|
||||
|
@ -3470,7 +3471,7 @@ class GetNext(Primitive):
|
|||
types (list[:class:`mindspore.dtype`]): The type of the outputs.
|
||||
shapes (list[tuple[int]]): The dimensionality of the outputs.
|
||||
output_num (int): The output number, length of `types` and `shapes`.
|
||||
shared_name (str): The queue name of `init_dataset` interface.
|
||||
shared_name (str): Queue name to fetch the data.
|
||||
|
||||
Inputs:
|
||||
No inputs.
|
||||
|
|
Loading…
Reference in New Issue