mindspore.ops.Range

class mindspore.ops.Range(maxlen=1000000)[source]

Creates a sequence of numbers that begins at start and extlimits by increments of delta up to but not including limit.

Refer to mindspore.ops.range() for more details.

Parameters

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.

Inputs:
  • start (Tensor) - A scalar Tensor. The first number in the sequence.

  • limit (Tensor) - A scalar Tensor. Upper limit of the sequence, exclusive.

  • delta (Tensor) - A scalar Tensor. Number that increments start.

Outputs:

A 1-D Tensor, with the same type as the inputs.

Supported Platforms:

GPU CPU

Examples

>>> from mindspore import Tensor, ops
>>> from mindspore import dtype as mstype
>>> start = Tensor(0, mstype.int32)
>>> limit = Tensor(10, mstype.int32)
>>> delta = Tensor(4, mstype.int32)
>>> output = ops.Range()(start, limit, delta)
>>> print(output)
[0 4 8]