sciai.common.StandardUniform

View Source On Gitee
class sciai.common.StandardUniform[source]

Generates an array with values sampled from Standard Uniform distribution \({U}(-\text{boundary}, \text{boundary})\) in order to initialize a tensor, where

\[boundary = \sqrt{\frac{1}{fan\_in}}\]

‘fan_in’ is the number of input units of the weight tensor.

Supported Platforms:

GPU CPU Ascend

Examples

>>> import mindspore
>>> from mindspore.common.initializer import initializer
>>> from sciai.common.initializer import StandardUniform
>>> tensor = initializer(StandardUniform(), [1, 2, 3], mindspore.float32)