jax.numpy.geomspace#
- jax.numpy.geomspace(start, stop, num=50, endpoint=True, dtype=None, axis=0)[源代码]#
生成几何间隔的值。
JAX 实现的
numpy.geomspace()
。- 参数:
- 返回:
一个包含几何间隔值的数组。
- 返回类型:
参见
jax.numpy.arange()
:给定起始点和步长值,生成N
个均匀间隔的值。jax.numpy.linspace()
:生成均匀间隔的值。jax.numpy.logspace()
:生成对数间隔的值。
示例
列出 1 到 16 之间 5 个几何间隔的值
>>> with jnp.printoptions(precision=3, suppress=True): ... jnp.geomspace(1, 16, 5) Array([ 1., 2., 4., 8., 16.], dtype=float32)
列出 1 到 16 之间 4 个几何间隔的值,其中
endpoint=False
>>> with jnp.printoptions(precision=3, suppress=True): ... jnp.geomspace(1, 16, 4, endpoint=False) Array([1., 2., 4., 8.], dtype=float32)
多维 geomspace
>>> start = jnp.array([1, 1000]) >>> stop = jnp.array([27, 1]) >>> with jnp.printoptions(precision=3, suppress=True): ... jnp.geomspace(start, stop, 4) Array([[ 1., 1000.], [ 3., 100.], [ 9., 10.], [ 27., 1.]], dtype=float32)