Creates a sequence of numbers.
Aliases:
tf.compat.v1.rangetf.compat.v2.range
tf.range(limit, delta=1, dtype=None, name='range')
tf.range(start, limit, delta=1, dtype=None, name='range')
Used in the guide:
Betterperformancewithtf.functionandAutoGraphTrainingcheckpoints``
Used in the tutorials:
Betterperformancewithtf.functionDeepDreamTransformermodelforlanguageunderstanding`` Creates a sequence of numbers that begins atstartand extends by increments ofdeltaup to but not includinglimit. The dtype of the resulting tensor is inferred from the inputs unless it is provided explicitly. Like the Python builtinrange,startdefaults to 0, so thatrange(n) =range(0, n).
For example:
start = 3
limit = 18
delta = 3
tf.range(start, limit, delta) # [3, 6, 9, 12, 15]
start = 3
limit = 1
delta = -0.5
tf.range(start, limit, delta) # [3, 2.5, 2, 1.5]
limit = 5
tf.range(limit) # [0, 1, 2, 3, 4]
Args:
start: A 0-DTensor(scalar). Acts as first entry in the range iflimitis not None; otherwise, acts as rangelimitand first entry defaults to 0.limit: A 0-DTensor(scalar). Upperlimitof sequence, exclusive. If None, defaults to the value ofstartwhile the first entry of the range defaults to 0.delta: A 0-DTensor(scalar). Number that incrementsstart. Defaults to 1.dtype: The type of the elements of the resulting tensor.name: Anamefor the operation. Defaults to "range".
Returns:
An 1-D Tensor of type dtype.
Numpy Compatibility
Equivalent to np.arange