sciai.common.XavierTruncNormal

View Source On Gitee
class sciai.common.XavierTruncNormal(trunc_interval=(- 2, 2))[source]

Xavier Truncated Normal Initialization with clip of 2 times of stddev from mean of Xavier Normal Initialization.

Parameters

trunc_interval (Union[None, tuple[Number]]) – Truncated normal interval. If (-2, 2), discarding and re-drawing any samples that are more than two standard deviations from mean 0. Default: (-2, 2).

Supported Platforms:

GPU CPU Ascend

Examples

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