Generate geometrically-spaced values.
JAX implementation of numpy.geomspace()
.
start (Array | ndarray | bool | number | bool | int | float | complex) – scalar or array. Specifies the starting values.
stop (Array | ndarray | bool | number | bool | int | float | complex) – scalar or array. Specifies the stop values.
num (int) – int, optional, default=50. Number of values to generate.
endpoint (bool) – bool, optional, default=True. If True, then include the stop
value in the result. If False, then exclude the stop
value.
dtype (str | type[Any] | dtype | SupportsDType | None) – optional. Specifies the dtype of the output.
axis (int) – int, optional, default=0. Axis along which to generate the geomspace.
An array containing the geometrically-spaced values.
Examples
List 5 geometrically-spaced values between 1 and 16:
>>> with jnp.printoptions(precision=3, suppress=True): ... jnp.geomspace(1, 16, 5) Array([ 1., 2., 4., 8., 16.], dtype=float32)
List 4 geomtrically-spaced values between 1 and 16, with endpoint=False
:
>>> with jnp.printoptions(precision=3, suppress=True): ... jnp.geomspace(1, 16, 4, endpoint=False) Array([1., 2., 4., 8.], dtype=float32)
Multi-dimensional 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)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4