按index索引选择序列中的值
例如:
import tensorflow as tf
seq = [1,2,3]
idxs = [2]
a = K.tf.batch_gather(seq, idxs)
with tf.Session() as sess:
print(a.eval())
结果输出:
3
import tensorflow as tf
seq = [1,2,3]
idxs = [1]
a = K.tf.batch_gather(seq, idxs)
with tf.Session() as sess:
print(a.eval())
结果输出:
2