tf.gather
tf.gather(params,indices)
'''
args:
params: 是一个一维张量
indices:需要提取数据的索引
'''
举例:
params=[1,4,7,9]
indices=[2,3]
print(tf.Session().run(tf.gather(params,indices)))
结果:
[7,9]
tf.gather
tf.gather(params,indices)
'''
args:
params: 是一个一维张量
indices:需要提取数据的索引
'''
举例:
params=[1,4,7,9]
indices=[2,3]
print(tf.Session().run(tf.gather(params,indices)))
结果:
[7,9]