mindspore.numpy.geomspace
- mindspore.numpy.geomspace(start, stop, num=50, endpoint=True, dtype=None, axis=0)[source]
Returns numbers spaced evenly on a log scale (a geometric progression).
This is similar to logspace, but with endpoints specified directly. Each output sample is a constant multiple of the previous.
- Parameters
start (Union[int, list(int), tuple(int), tensor]) – The starting value of the sequence.
stop (Union[int, list(int), tuple(int), tensor]) – The final value of the sequence, unless endpoint is False. In that case, num + 1 values are spaced over the interval in log-space, of which all but the last (a sequence of length num) are returned.
num (int, optional) – Number of samples to generate. Default is 50.
endpoint (bool, optional) – If True, stop is the last sample. Otherwise, it is not included. Default is True.
dtype (Union[
mindspore.dtype
, str], optional) – Designated tensor dtype, can be in format of np.float32, or float32.If dtype is None, infer the data type from other input arguments. Default is None.axis (int, optional) – The axis in the result to store the samples. Relevant only if start or stop is array-like. By default (0), the samples will be along a new axis inserted at the beginning. Use -1 to get an axis at the end. Default is 0.
- Returns
Tensor, with samples equally spaced on a log scale.
- Raises
TypeError – If input arguments have types not specified above.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> output = np.geomspace(1, 256, num=9) >>> print(output) [ 1. 2. 4. 8. 16. 32. 64. 128. 256.] >>> output = np.geomspace(1, 256, num=8, endpoint=False) >>> print(output) [ 1. 2. 4. 8. 16. 32. 64. 128.]