#tf.slice(input, begin, size)
>>> sess.run(n)
array([[[ 1, 2, 3, 4, 5, 6],
[ 7, 8, 9, 10, 11, 12]]])
>>> n1 = tf.slice(n, [0,0,0], [-1,-1,3])
>>> sess.run(n1)
array([[[1, 2, 3],
[7, 8, 9]]])
>>> n2 = tf.slice(n, [0,0,3], [-1,-1,3])
>>> sess.run(n2)
array([[[ 4, 5, 6],
[10, 11, 12]]])
>>>
>>> n3 = tf.slice(n, [0,0,3], [1,1,3])
>>> sess.run(n3)
array([[[4, 5, 6]]])
网友评论