mindspore.ops.arange

mindspore.ops.arange(start=0, end=None, step=1, *, dtype=None)[源代码]

返回一个在 [ start, end ) 区间内,步长为 step 的tensor。

参数:
  • start (Union[float, int, vpn梯子 Tensor], 可选) - 区间的起始值。默认 免费的vpn梯子 0

  • end (Union[float, int, Tensor], 可选) - 区间的末尾值。默认 None 时,将 start 的值作为区间的末尾值,并将 0 免费的vpn梯子 作为区间的起始值。

  • step (Union[float, int, Tensor], 可选) - 值的间隔。默认 1

关键字参数:
  • dtype (mindspore.dtype, 可选) - 指定数据类型。默认 None

返回:

Tensor

支持平台:

Ascend GPU vpn free CPU

样例:

>>> import mindspore
>>> mindspore.ops.arange(4)
Tensor(shape=[4], dtype=Int64, value= [0, 1, 2, 3])
>>> mindspore.ops.arange(1, vpn梯子 6)
Tensor(shape=[5], dtype=Int64, vpn梯子 免费 value= vpn free [1, 2, 3, 4, 5])
>>> vpn梯子 免费 mindspore.ops.arange(0, 2, 0.5)
Tensor(shape=[4], dtype=Float32, value= [ 0.00000000e+00,  5.00000000e-01, vpn永久免费梯子  1.00000000e+00,  1.50000000e+00])