import tensorflow as tf x = [[1,2,3],[4,5,6]] y = [0,1] z = [1,2] x = tf.constant(x) y = tf.constant(y) z = tf.constant(z) m = x[y,z]
I expect m = [2,6]
m = [2,6]
I can get the result byanano or numpy. How to get the result using tensor flow?
Would you like to use tf.gather_nd
slices = tf.gather_nd(x, [y, z])
Hope this helps.
Source: https://habr.com/ru/post/1259120/More articles:Remove xmlns: me and xmlns from webapi - c #Check for FormData - jqueryWindows Ce device does not deploy "Bootloader cannot be loaded." - c #double entry: com / google / android / gms / internal / zzahl.class - androidteam has already reached the maximum number of iPhone devices - iosImport spring boot application into another project - spring-boot"Inline compilation error" when executing JavaScript code in JavaScriptCore - javascriptChrome Dev Tools: save user geolocation in Dev Tools settings - javascriptMongoDB client throws a FileNotFoundException in mscorlib - c #Change RStudio Editor Theme - cssAll Articles