jax.random.lognormal#

jax.random.lognormal(key, sigma=np.float32(1.0), shape=None, dtype=<class 'float'>)[source]#

使用给定的形状和浮点 dtype 采样对数正态随机值。

这些值根据概率密度函数分布

\[f(x) = \frac{1}{x\sqrt{2\pi\sigma^2}}\exp\left(-\frac{(\log x)^2}{2\sigma^2}\right)\]

定义域为 \(x > 0\)

参数:
  • key (ArrayLike) – 用作随机密钥的 PRNG 密钥。

  • sigma (RealArray) – 与 shape 广播兼容的浮点数或浮点数数组,表示底层正态分布的标准差。 默认为 1。

  • shape (Shape | None) – 可选,指定结果形状的非负整数元组。 默认值 (None) 生成一个等于 () 的结果形状。

  • dtype (DTypeLikeFloat) – 可选,返回值的浮点数 dtype(如果 jax_enable_x64 为 true,则默认为 float64,否则为 float32)。

返回:

具有指定 dtype 和形状为 shape 的随机数组。

返回类型:

Array