mindspore.ops.linspace
- mindspore.ops.linspace(start, end, steps)[source]
Generate a one-dimensional tensor with steps elements, evenly distributed in the interval [start, end].
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> output = mindspore.ops.linspace(3, 10, 5) >>> print(output) [ 3. 4.75 6.5 8.25 10. ] >>> output = mindspore.ops.linspace(-10, 10, 5) >>> print(output) [-10. -5. 0. 5. 10.] >>> output = mindspore.ops.linspace(-10, 10, 1) >>> print(output) [-10.]