Browse Source

fix formula

pull/1/head
wanyiming 4 years ago
parent
commit
c37243d49d
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      docs/api/api_python/mindspore.common.initializer.rst
  2. +2
    -2
      mindspore/python/mindspore/common/initializer.py

+ 2
- 2
docs/api/api_python/mindspore.common.initializer.rst View File

@@ -193,9 +193,9 @@ mindspore.common.initializer

生成一个随机的矩阵用于初始化Tensor。
当 `distribution` 是'truncated_normal'或者'untruncated_normal'时,矩阵中的值将服从均值为0,标准差
为 :math:`stddev = \sqrt{\scale{6}{n}}` 的截断或者非截断正太分布。如果 `mode` 是'fan_in', :math:`n` 是输入单元的数量;
为 :math:`stddev = \sqrt{\frac{scale}{n}}` 的截断或者非截断正太分布。如果 `mode` 是'fan_in', :math:`n` 是输入单元的数量;
如果 `mode` 是'fan_out', :math:`n` 是输出单元的数量;如果 `mode` 是'fan_avg', :math:`n` 是输入输出单元数量的均值。
当 `distribution` 是'uniform'时,矩阵中的值将服从均匀分布 :math:`[-\sqrt{\scale{3*scale}{n}}, \sqrt{\scale{3*scale}{n}}]`。
当 `distribution` 是'uniform'时,矩阵中的值将服从均匀分布 :math:`[-\sqrt{\frac{3*scale}{n}}, \sqrt{\frac{3*scale}{n}}]`。

**参数:**



+ 2
- 2
mindspore/python/mindspore/common/initializer.py View File

@@ -538,10 +538,10 @@ class VarianceScaling(Initializer):
Generates an random array with scaling in order to initialize a tensor.
When `distribution` is 'truncated_normal' or 'untruncated_normal', the value will be sampled from truncated or
untruncated normal distribution with a mean of 0 and a scaled standard deviation
:math:`stddev = \sqrt{\scale{6}{n}}`. :math:`n` will be the number of input units if `mode` is 'fan_in',
:math:`stddev = \sqrt{\frac{scale}{n}}`. :math:`n` will be the number of input units if `mode` is 'fan_in',
the number of output units if `mode` is 'fan_out', the average of 'fan_in' and 'fan_out' if `mode` is 'fan_avg'.
When `distribution` is 'uniform', the value will be sampled from a uniform distribution within the limit of
:math:`[-\sqrt{\scale{3*scale}{n}}, \sqrt{\scale{3*scale}{n}}]`.
:math:`[-\sqrt{\frac{3*scale}{n}}, \sqrt{\frac{3*scale}{n}}]`.

Args:
scale (float): The scaling factor. Default: 1.0.


Loading…
Cancel
Save