mindspore.ops.range

mindspore.ops.range(start, limit, delta)[source]

Creates a sequence of numbers that begins at start and extends by increments of delta up to but not including limit. Length of the created sequence can not exceed 1000000.

The types of all 3 inputs must be the same. The type of the resulting tensor is the same as the type of the inputs.

Parameters
  • start (Tensor) – A scalar Tensor. The first number in the sequence. Must have type: int32 or float32.

  • limit (Tensor) – A scalar Tensor. Upper limit of the sequence, exclusive. Must have type: int32 or float32.

  • delta (Tensor) – A scalar Tensor. Number that increments start. Must have type: int32 or float32.

Returns

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

Supported Platforms:

GPU CPU

Examples

>>> 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]