range(limit, delta=1, dtype=None, name='range')
range(start, limit, delta=1, dtype=None, name='range')
从start开始,到limit结束(不包括limit),间隔delta,生成一维序列
import tensorflow as tf
with tf.Session() as sess:
# tf.range(start, limit, delta)
a = tf.range(3, 18, 3)
print(sess.run(a))
b = tf.range(3, 1, -0.5)
print(sess.run(b))
c = tf.range(5)
print(sess.run(c))
结果
[ 3 6 9 12 15]
[3. 2.5 2. 1.5]
[0 1 2 3 4]