|  View source on GitHub | 
Creates a sequence of numbers.
tf.range(limit, delta=1, dtype=None, name='range')
tf.range(start, limit, delta=1, dtype=None, name='range')
Creates a sequence of numbers that begins at start and extends by
increments of delta up to but not including limit.
The dtype of the resulting tensor is inferred from the inputs unless it is provided explicitly.
Like the Python builtin range, start defaults to 0, so that
range(n) = range(0, n).
For example:
start = 3limit = 18delta = 3tf.range(start, limit, delta)<tf.Tensor: shape=(5,), dtype=int32,numpy=array([ 3, 6, 9, 12, 15], dtype=int32)>
start = 3limit = 1delta = -0.5tf.range(start, limit, delta)<tf.Tensor: shape=(4,), dtype=float32,numpy=array([3. , 2.5, 2. , 1.5], dtype=float32)>
limit = 5tf.range(limit)<tf.Tensor: shape=(5,), dtype=int32,numpy=array([0, 1, 2, 3, 4], dtype=int32)>
| Returns | |
|---|---|
| An 1-D Tensorof typedtype. | 
numpy compatibility
Equivalent to np.arange