# arange¶

ivy.arange(stop, start=0, step=1, dtype_str=None, dev_str=None, f=None)[source]

Returns evenly spaced values within a given interval, with the spacing being specified.

Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python built-in range function, but returns an array in the chosen ml_framework rather than a list.

See $$linspace$$ for a certain number of evenly spaced values in an interval.

Parameters
• stop (number) – End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.

• start (number, optional) – Start of interval. The interval includes this value. The default start value is 0.

• step (number, optional) – Spacing between values. For any output out, this is the distance between two adjacent values, out[i+1] - out[i]. The default step size is 1. If step is specified as a position argument, start must also be given.

• dtype_str (data-type string, optional) – The desired data-type for the array in string format, i.e. ‘float32’ or ‘int64’. If not given, then the type will be determined as the minimum type required to hold the objects in the sequence.

• dev_str (str) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.

• f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

Tensor of evenly spaced values.

For floating point arguments, the length of the result is ceil((stop - start)/step). Because of floating point overflow, this rule may result in the last element of out being greater than stop.

Supported Frameworks: