I want to convert this kind of indexing:
a = tf.ones((500, 1000))
a[1:150, 50:700]
Into :
a[idx_x, idx_y]
We can obviously use a while
loop to construct the two vectors. But what is the most efficient way to do this in tensorflow?
I want to convert this kind of indexing:
a = tf.ones((500, 1000))
a[1:150, 50:700]
Into :
a[idx_x, idx_y]
We can obviously use a while
loop to construct the two vectors. But what is the most efficient way to do this in tensorflow?
You can generate the index values as:
Then you would use those as: