简体   繁体   中英

Reshuffle tensor according to other specific tensor in Tensorflow

Given certain tensors a and b where b is of type uint and max(b) < len(a) , I would like to get a tensor c :

c = a[b]

This would essentially reshuffle tensor a according to order given by b .

Just to close the question - as per @jdehesa 's comment:

c = tf.gather(a, b)

This was exactly needed. Thanks @jdehesa!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM