用法
#encoding=utf-8
import tensorflow as tf
x = tf.constant([11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22], shape = [6,2])
#x的第0,2,4行作为y的第0行;x的第1,3,5行作为y的第3行
v = tf.constant([0, 3, 0, 3, 0, 3])
#由于y至少有4行,所以第三个参数最小是4
y = tf.dynamic_partition(x, v, 4)
with tf.Session() as sess:
for i in range(len(y)):
print
print(sess.run(y)[i])
'''
[[11 12]
[15 16]
[19 20]]
[]
[]
[[13 14]
[17 18]
[21 22]]
'''