mindspore/docs/api/api_python/ops/mindspore.ops.func_linspace...

28 lines
1.2 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.linspace
======================
.. py:function:: mindspore.ops.linspace(start, end, steps)
返回一个在区间 `start``end` (包括 `start``end` )内均匀分布的,包含 `steps` 个值的一维Tensor。
.. math::
\begin{aligned}
&step_len = (end - start)/(steps - 1)\\
&output = [start, start+step_len, start+2*step_len, ... , end]
\end{aligned}
参数:
- **start** (Union[Tensor, int, float]) - 零维Tensor数据类型必须为float32。区间的起始值。
- **end** (Union[Tensor, int, float]) - 零维Tensor数据类型必须为float32。区间的末尾值。
- **steps** (Union[Tensor, int]) - 间隔中的包含的数值数量,包括区间端点。必须为正数。
返回:
Tensor具有与 `start` 相同的dtypeshape为 :math:`(steps)`
异常:
- **TypeError** - `start``end` 不是Tensor。
- **TypeError** - `start``end` 的数据类型不是float32。
- **ValueError** - `start``end` 的维度不是0。
- **TypeError** - `steps` 不是int类型。
- **ValueError** - `steps` 不是正数。