jax.random.rayleigh#

jax.random.rayleigh(key, scale, shape=None, dtype=<class 'float'>)[源代码]#

采样具有给定形状和浮点 dtype 的 Rayleigh 随机值。

根据概率密度函数返回这些值

\[f(x;\sigma) \propto xe^{-x^2/(2\sigma^2)}\]

在定义域 \(-\infty < x < \infty\) 上,其中 \(\sigma > 0\) 是分布的尺度参数。

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

  • scale (RealArray) – 一个浮点数或与 shape 广播兼容的浮点数数组,表示分布的参数。

  • shape (Shape | None | None) – 可选,一个指定结果形状的非负整数元组。必须与 scale 广播兼容。默认值(None)生成的结果形状等于 scale.shape

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

返回:

一个具有指定 dtype 和形状的随机数组,如果 shape 不为 None,则形状由 shape 给定,否则由 scale.shape 给定。

返回类型:

数组