r""" Return fixed number of logarithmically-evenly spaced values within the interval \ :math:`[base^{start}, base^{stop}]`. Notes: This API does not compute the gradient. Args: start(int|float|Tensor): The input :attr:`start` is exponent of first entry in \
(
start: float | paddle.Tensor,
stop: float | paddle.Tensor,
num: int | paddle.Tensor,
base: float | paddle.Tensor = 10.0,
dtype: DTypeLike | None = None,
name: str | None = None,
)
| 554 | |
| 555 | |
| 556 | def logspace( |
| 557 | start: float | paddle.Tensor, |
| 558 | stop: float | paddle.Tensor, |
| 559 | num: int | paddle.Tensor, |
| 560 | base: float | paddle.Tensor = 10.0, |
| 561 | dtype: DTypeLike | None = None, |
| 562 | name: str | None = None, |
| 563 | ) -> paddle.Tensor: |
| 564 | r""" |
| 565 | Return fixed number of logarithmically-evenly spaced values within the interval \ |
| 566 | :math:`[base^{start}, base^{stop}]`. |
| 567 | |
| 568 | Notes: |
| 569 | This API does not compute the gradient. |
| 570 | |
| 571 | Args: |
| 572 | start(int|float|Tensor): The input :attr:`start` is exponent of first entry in \ |
| 573 | the sequence. It is a scalar, or a 0-D Tensor of shape [] with input data \ |
| 574 | type int32, int64, float32 or float64. |
| 575 | stop(int|float|Tensor): The input :attr:`stop` is exponent of last entry in the \ |
| 576 | sequence. It is a scalar, or a 0-D Tensor of shape [] with input data \ |
| 577 | type int32, int64, float32 or float64. |
| 578 | num(int|Tensor): The input :attr:`num` is given number of items in the sequence. \ |
| 579 | It is an int scalar, or a 0-D Tensor of shape [] with data type int32. |
| 580 | base(int|float|Tensor): The input :attr:`base` is base of the logarithm function. \ |
| 581 | It is a scalar, or a 0-D Tensor of shape [] with input data type int32, int64, \ |
| 582 | float32 or float64. |
| 583 | dtype(str|paddle.dtype|np.dtype, optional): The data type of output tensor, it could be \ |
| 584 | int32, int64, float32 or float64. Default: if None, the data type is float32. \ |
| 585 | name(str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None. |
| 586 | |
| 587 | Returns: |
| 588 | Tensor: The output data type will be float32, float64. The 1-D tensor with \ |
| 589 | fixed number of logarithmically-evenly spaced values, the data shape of this \ |
| 590 | tensor is :math:`[num]`. If the :attr:`num` is set 1, the output tensor \ |
| 591 | just has the value with exponential of :attr:`start` with base :attr:`base`. |
| 592 | |
| 593 | Examples: |
| 594 | .. code-block:: pycon |
| 595 | |
| 596 | >>> import paddle |
| 597 | >>> data = paddle.logspace(0, 10, 5, 2, 'float32') |
| 598 | >>> print(data.numpy()) |
| 599 | [1.0000000e+00 5.6568542e+00 3.2000000e+01 1.8101933e+02 1.0240000e+03] |
| 600 | >>> data = paddle.logspace(0, 10, 1, 2, 'float32') |
| 601 | >>> print(data.numpy()) |
| 602 | [1.] |
| 603 | """ |
| 604 | if dtype is None: |
| 605 | dtype = paddle.get_default_dtype() |
| 606 | tensor_num = num |
| 607 | tensor_start = start |
| 608 | tensor_stop = stop |
| 609 | tensor_base = base |
| 610 | if not isinstance(num, (Variable, paddle.pir.Value)): |
| 611 | check_type(num, 'num', (int), 'logspace') |
| 612 | if not isinstance(dtype, (core.VarDesc.VarType, core.DataType)): |
| 613 | dtype = convert_np_dtype_to_dtype_(dtype) |
nothing calls this directly
no test coverage detected