Python API
normal
服从高斯分布的随机变量 \(N(\mu, \sigma)\)
size (Optional[Iterable[int]]) – 输出张量的形状
Optional
Iterable
int
mean (float) – 分布的期望(平均数)
float
std (float) – 分布的标准差 (variance = \(\sigma ^ 2\))
Tensor
输出张量
例如:
import megengine as mge import megengine.random as rand x = rand.normal(mean=0, std=1, size=(2, 2)) print(x.numpy())
输出:
[[-0.20235455 -0.6959438 ] [-1.4939808 -1.5824696 ]]