logspace¶
- paddle. logspace ( start, stop, num, base=10.0, dtype=None, name=None ) [source]
-
Return fixed number of logarithmical-evenly spaced values within the interval \([base^{start}, base^{stop}]\).
Notes
This API does not compute the gradient.
- Parameters
-
start (int|float|Tensor) – The input
startis exponent of first entry in the sequence. It is a scalar, or a 0-D Tensor of shape [] with input data type int32, int64, float32 or float64.stop (int|float|Tensor) – The input
stopis exponent of last entry in the sequence. It is a scalar, or a 0-D Tensor of shape [] with input data type int32, int64, float32 or float64.num (int|Tensor) – The input
numis given number of items in the sequence. It is an int scalar, or a 0-D Tensor of shape [] with data type int32.base (int|float|Tensor) – The input
baseis base of the logarithm function. It is a scalar, or a 0-D Tensor of shape [] with input data type int32, int64, float32 or float64.dtype (np.dtype|str, optional) – The data type of output tensor, it could be int32, int64, float32 or float64. Default: if None, the data type is float32.
name (str, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.
- Returns
-
The output data type will be float32, float64. The 1-D tensor with fixed number of logarithmical-evenly spaced values, the data shape of this tensor is \([num]\). If the
numis set 1, the output tensor just has the value with exponential ofstartwith basebase. - Return type
-
Tensor
Examples
import paddle data = paddle.logspace(0, 10, 5, 2, 'float32') # [1. , 5.65685415 , 32. , 181.01933289, 1024. ] data = paddle.logspace(0, 10, 1, 2, 'float32') # [1.]
