mindspore.ops.LinSpace
- class mindspore.ops.LinSpace[source]
Returns a Tensor whose value is num evenly spaced in the interval start and stop (including start and stop), and the length of the output Tensor is num.
Refer to
mindspore.ops.linspace()
for more details.- Inputs:
start (Tensor) - Start value of interval, 0-D Tensor with dtype float32 or float64.
stop (Tensor) - Last value of interval, 0-D Tensor with dtype float32 or float64.
num (Union[int, Tensor]) - Number of ticks in the interval, inclusive of start and stop. Must be a positive integer. When the input is Tensor, it must be a 0-D Tensor with dtype int32 or int64.
- Outputs:
Tensor, has the same shape and dtype as start.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> from mindspore import Tensor, ops >>> linspace = ops.LinSpace() >>> start = Tensor(1, mindspore.float32) >>> stop = Tensor(10, mindspore.float32) >>> num = 5 >>> output = linspace(start, stop, num) >>> print(output) [ 1. 3.25 5.5 7.75 10. ]