mindspore.ops.range

View Source On Gitee
mindspore.ops.range(start, end, step, maxlen=1000000)[source]

Returns a tensor with a step length of step in the interval [ start , end ).

Note

The types of all 3 inputs must be all integers or floating-point numbers.

Parameters
  • start (number) – The start value of the interval.

  • end (number) – The end value of the interval.

  • step (number) – The interval between each value.

  • maxlen (int, optional) – Memory that can fit maxlen many elements will be allocated for the output. Optional, must be positive. Default: 1000000. If the output has more than maxlen elements, a runtime error will occur.

Returns

Tensor

Supported Platforms:

GPU CPU

Examples

>>> from mindspore
>>> mindspore.ops.range(0, 6, 2)
Tensor(shape=[3], dtype=Int64, value= [0, 2, 4])