高端索引tf.gather_nd(params, indices)
程序员文章站
2022-04-18 11:47:14
...
import tensorflow as tf
import numpy as np
params = np.arange(23)
a = tf.gather(params,1)
with tf.Session() as sess:
print(sess.run(a))
params = np.arange(24).reshape(2,-1)
a = tf.gather(params,1)
with tf.Session() as sess:
print(sess.run(a))
b = tf.gather_nd(params,[1,3])
with tf.Session() as sess:
print(sess.run(b))
1
[12 13 14 15 16 17 18 19 20 21 22 23]
15
上一篇: struts2 ognl
下一篇: OGNL(Struts2)