tf.gather()函数的作用

import tensorflow as tf

temp = tf.range(0,10)*10 + tf.constant(1,shape=[10])
temp2 = tf.gather(temp,[1,5,9])

with tf.Session() as sess:

    print sess.run(temp)
    print sess.run(temp2)

输出 
[ 1 11 21 31 41 51 61 71 81 91] 
[11 51 91]

tf.gather()用来取出tensor中指定索引位置的元素。

--------------------- 
作者:guotong1988 
来源:CSDN 
原文:https://blog.csdn.net/guotong1988/article/details/53172882 
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/orangefly0214/article/details/83215483