forked from mindspore-Ecosystem/mindspore
update docs for expand_dims and instance norm
This commit is contained in:
parent
4c9b6b06cb
commit
028d00d7d9
|
@ -26,8 +26,8 @@ mindspore.nn.InstanceNorm1d
|
|||
- **eps** (float) - 添加到分母中的值,以确保数值稳定。默认值:1e-5。
|
||||
- **momentum** (float) - 动态均值和动态方差所使用的动量。默认值:0.1。
|
||||
- **affine** (bool) - bool类型。设置为True时,可以学习gamma和beta参数。默认值:True。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。使用Tensor作为初始化参数时,shape必须为 :math:`(C)` 。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。使用Tensor作为初始化参数时,shape必须为 :math:`(C)` 。默认值:'zeros'。
|
||||
|
||||
输入:
|
||||
- **x** (Tensor) - shape为 :math:`(N, C, L)` 的Tensor。数据类型为float16或float32。
|
||||
|
@ -43,4 +43,5 @@ mindspore.nn.InstanceNorm1d
|
|||
- **TypeError** - `gamma_init` / `beta_init` 的类型不相同,或者初始化的元素类型不是float32。
|
||||
- **ValueError** - `num_features` 小于1。
|
||||
- **ValueError** - `momentum` 不在范围[0, 1]内。
|
||||
- **ValueError** - `gamma_init` / `beta_init` 的shape不为 :math:`(C)` 。
|
||||
- **KeyError** - `gamma_init` / `beta_init` 中的任何一个是str,并且不存在继承自 `Initializer` 的同义类。
|
||||
|
|
|
@ -26,8 +26,8 @@ mindspore.nn.InstanceNorm2d
|
|||
- **eps** (float) - 添加到分母中的值,以确保数值稳定。默认值:1e-5。
|
||||
- **momentum** (float) - 动态均值和动态方差所使用的动量。默认值:0.1。
|
||||
- **affine** (bool) - bool类型。设置为True时,可以学习gamma和beta参数。默认值:True。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。使用Tensor作为初始化参数时,shape必须为 :math:`(C)`。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。使用Tensor作为初始化参数时,shape必须为 :math:`(C)`。默认值:'zeros'。
|
||||
|
||||
输入:
|
||||
- **x** (Tensor) - shape为 :math:`(N, C, H, W)` 的Tensor。数据类型为float16或float32。
|
||||
|
@ -43,4 +43,5 @@ mindspore.nn.InstanceNorm2d
|
|||
- **TypeError** - `gamma_init` / `beta_init` 的类型不相同,或者初始化的元素类型不是float32。
|
||||
- **ValueError** - `num_features` 小于1。
|
||||
- **ValueError** - `momentum` 不在范围[0, 1]内。
|
||||
- **ValueError** - `gamma_init` / `beta_init` 的shape不为 :math:`(C)` 。
|
||||
- **KeyError** - `gamma_init` / `beta_init` 中的任何一个是str,并且不存在继承自 `Initializer` 的同义类。
|
||||
|
|
|
@ -26,8 +26,8 @@ mindspore.nn.InstanceNorm3d
|
|||
- **eps** (float) - 添加到分母中的值,以确保数值稳定。默认值:1e-5。
|
||||
- **momentum** (float) - 动态均值和动态方差所使用的动量。默认值:0.1。
|
||||
- **affine** (bool) - bool类型。设置为True时,可以学习gamma和beta参数。默认值:True。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。默认值:'zeros'。
|
||||
- **gamma_init** (Union[Tensor, str, Initializer, numbers.Number]) - gamma参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。使用Tensor作为初始化参数时,shape必须为 :math:`(C)`。默认值:'ones'。
|
||||
- **beta_init** (Union[Tensor, str, Initializer, numbers.Number]) - beta参数的初始化方法。str的值引用自函数 `initializer` ,包括'zeros'、'ones'等。使用Tensor作为初始化参数时,shape必须为 :math:`(C)`。默认值:'zeros'。
|
||||
|
||||
输入:
|
||||
- **x** (Tensor) - shape为 :math:`(N, C, D, H, W)` 的Tensor。数据类型为float16或float32。
|
||||
|
@ -43,4 +43,5 @@ mindspore.nn.InstanceNorm3d
|
|||
- **TypeError** - `gamma_init` / `beta_init` 的类型不相同,或者初始化的元素类型不是float32。
|
||||
- **ValueError** - `num_features` 小于1。
|
||||
- **ValueError** - `momentum` 不在范围[0, 1]内。
|
||||
- **ValueError** - `gamma_init` / `beta_init` 的shape不为 :math:`(C)` 。
|
||||
- **KeyError** - `gamma_init` / `beta_init` 中的任何一个是str,并且不存在继承自 `Initializer` 的同义类。
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mindspore.ops.expand_dims
|
||||
=========================
|
||||
|
||||
.. py:function:: mindspore.ops.expand_dims(a, axis)
|
||||
.. py:function:: mindspore.ops.expand_dims(input_x, axis)
|
||||
|
||||
对输入 `input_x` 在给定的轴上添加额外维度。
|
||||
|
||||
|
@ -13,7 +13,7 @@ mindspore.ops.expand_dims
|
|||
backward from the end and starts at 1.
|
||||
|
||||
参数:
|
||||
- **a** (Tensor) - 输入Tensor,shape为 :math:`(x_1, x_2, ..., x_R)`。
|
||||
- **input_x** (Tensor) - 输入Tensor,shape为 :math:`(x_1, x_2, ..., x_R)`。
|
||||
- **axis** (Union[int, list(int), tuple(int)]) - 新插入的维度的位置。`axis` 的值必须在范围 `[-input_x.ndim-1, input_x.ndim]` 内。仅接受常量输入。
|
||||
|
||||
返回:
|
||||
|
|
|
@ -879,7 +879,7 @@ class _InstanceNorm(Cell):
|
|||
gamma_init='ones',
|
||||
beta_init='zeros',
|
||||
input_dims='2d'):
|
||||
"""Initialize InstanceNorm2d."""
|
||||
"""Initialize Normalization base class."""
|
||||
super(_InstanceNorm, self).__init__()
|
||||
validator.check_value_type('num_features', num_features, [int], self.cls_name)
|
||||
validator.check_value_type('eps', eps, [float], self.cls_name)
|
||||
|
@ -962,9 +962,11 @@ class InstanceNorm1d(_InstanceNorm):
|
|||
running_mean and running_var computation. Default: 0.1.
|
||||
affine (bool): A bool value. When set to True, gamma and beta can be learned. Default: True.
|
||||
gamma_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the gamma weight.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc. Default: 'ones'.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc.
|
||||
When initialized with Tensor, the shape should be :math:`(C)`. Default: 'zeros'.
|
||||
beta_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the beta weight.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc. Default: 'zeros'.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc.
|
||||
When initialized with Tensor, the shape should be :math:`(C)`. Default: 'zeros'.
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - Tensor of shape :math:`(N, C, L)`. Data type: float16 or float32.
|
||||
|
@ -985,6 +987,7 @@ class InstanceNorm1d(_InstanceNorm):
|
|||
float32.
|
||||
ValueError: If `num_features` is less than 1.
|
||||
ValueError: If `momentum` is not in range [0, 1].
|
||||
ValueError: If the shape of `gamma_init` / `beta_init` is not :math:`(C)`.
|
||||
KeyError: If any of `gamma_init`/`beta_init` is str and the homonymous class inheriting from `Initializer` not
|
||||
exists.
|
||||
|
||||
|
@ -1049,9 +1052,11 @@ class InstanceNorm2d(_InstanceNorm):
|
|||
running_mean and running_var computation. Default: 0.1.
|
||||
affine (bool): A bool value. When set to True, gamma and beta can be learned. Default: True.
|
||||
gamma_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the gamma weight.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc. Default: 'ones'.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc.
|
||||
When initialized with Tensor, the shape should be :math:`(C)`. Default: 'zeros'.
|
||||
beta_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the beta weight.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc. Default: 'zeros'.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc.
|
||||
When initialized with Tensor, the shape should be :math:`(C)`. Default: 'zeros'.
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - Tensor of shape :math:`(N, C, H, W)`. Data type: float16 or float32.
|
||||
|
@ -1072,6 +1077,7 @@ class InstanceNorm2d(_InstanceNorm):
|
|||
float32.
|
||||
ValueError: If `num_features` is less than 1.
|
||||
ValueError: If `momentum` is not in range [0, 1].
|
||||
ValueError: If the shape of `gamma_init` / `beta_init` is not :math:`(C)`.
|
||||
KeyError: If any of `gamma_init`/`beta_init` is str and the homonymous class inheriting from `Initializer` not
|
||||
exists.
|
||||
|
||||
|
@ -1136,9 +1142,11 @@ class InstanceNorm3d(_InstanceNorm):
|
|||
running_mean and running_var computation. Default: 0.1.
|
||||
affine (bool): A bool value. When set to True, gamma and beta can be learned. Default: True.
|
||||
gamma_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the gamma weight.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc. Default: 'ones'.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc.
|
||||
When initialized with Tensor, the shape should be :math:`(C)`. Default: 'zeros'.
|
||||
beta_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the beta weight.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc. Default: 'zeros'.
|
||||
The values of str refer to the function `initializer` including 'zeros', 'ones', etc.
|
||||
When initialized with Tensor, the shape should be :math:`(C)`. Default: 'zeros'.
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - Tensor of shape :math:`(N, C, D, H, W)`. Data type: float16 or float32.
|
||||
|
@ -1159,6 +1167,7 @@ class InstanceNorm3d(_InstanceNorm):
|
|||
float32.
|
||||
ValueError: If `num_features` is less than 1.
|
||||
ValueError: If `momentum` is not in range [0, 1].
|
||||
ValueError: If the shape of `gamma_init` / `beta_init` is not :math:`(C)`.
|
||||
KeyError: If any of `gamma_init`/`beta_init` is str and the homonymous class inheriting from `Initializer` not
|
||||
exists.
|
||||
|
||||
|
|
Loading…
Reference in New Issue