Skip to content
fn

arange_op

→TensorImplPtr
int arange_op(double start, double stop, double step, Dtype dt, Device device, bool requires_grad)

Python wrappers

Public Python APIs implemented by this engine symbol.

Create a 1-D tensor with values [start,start+step,… )[\text{start}, \text{start}+\text{step}, \dots) up to but not including stop.

Math

Output length is ⌈(stop−start)/step⌉\lceil (\text{stop} - \text{start}) / \text{step} \rceil; element ii equals start+i⋅step\text{start} + i \cdot \text{step}.

Parameters

startdouble
First value of the progression.
stopdouble
Exclusive upper bound.
stepdouble
Constant stride. Must be non-zero.
dtDtype
Element dtype (the values are cast at the end).
deviceDevice
Target device.
requires_gradbool
Attach a fresh autograd leaf when true.

Returns

TensorImplPtr

1-D tensor of length ⌈(stop−start)/step⌉\lceil (\text{stop} - \text{start}) / \text{step} \rceil.

Raises

LucidError
If step == 0.