tf.strided_slice 实例

tf.strided_slice 实例

import tensorflow as tf data = [1,2,3,4,5,6,7,8] x = tf.strided_slice(data,[0],[4]) y = tf.strided_slice(data,[1],[5]) with tf.session() as sess: PRint(sess.run(x)) print(sess.run(y))

结果 [1 2 3 4] [2 3 4 5]

import tensorflow as tf data = [[1,2,3,4,5,6,7,8],[11,12,13,14,15,16,17,18]] x = tf.strided_slice(data,[0,0],[1,4]) y = tf.strided_slice(data,[1,1],[2,5]) with tf.Session() as sess: print(sess.run(x)) print(sess.run(y))

结果 [[1 2 3 4]] [[12 13 14 15]]